fidesio/sonata-admin-jms-translations

Add JMSTranslationBundle to SonataAdminBundle

Installs: 120

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 22

Forks: 3

Type:symfony-bundle

2.3.x-dev 2015-06-10 13:45 UTC

This package is not auto-updated.

Last update: 2024-12-21 17:33:06 UTC


README

Features:

  • Integrate JMSTranslationBundle with SonataAdminBundle
  • Provides add translation message form
  • Invalidate cache from web-interface
  • Remove translation from web-interface

Installation:

Step 1: Download KASonataAdminJMSTranslationBundle using composer

Add KASonataAdminJMSTranslationBundle in your composer.json:

For Sonata admin <=2.2 use:

{
    "require": {
        "kluev-andrew/sonata-admin-jms-translations": "dev-master"
    }
}

For Sonata admin >=2.3 use:

{
    "require": {
        "kluev-andrew/sonata-admin-jms-translations": ">=2.3"
    }
}

Now tell composer to download the bundle by running the command:

$ php composer.phar update kluev-andrew/sonata-admin-jms-translations

Composer will install the bundle to your project's KA/SonataAdminJMSTranslationBundle directory.

Step 2: Enable the bundle

Enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new JMS\DiExtraBundle\JMSDiExtraBundle($this),
        new JMS\AopBundle\JMSAopBundle(),
        new JMS\TranslationBundle\JMSTranslationBundle(),
        new Fidesio\SonataAdminJMSTranslationBundle\KASonataAdminJMSTranslationBundle(),
        // ...
    );
}

Step 3: Import KASonataAdminJMSTranslationBundle routing

In YAML somthing like:

# app/config/routing.yml

admin:
    resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
    prefix: /admin

KASonataAdminJMSTranslationBundle_ui:
    resource: @KASonataAdminJMSTranslationBundle/Controller/
    type:     annotation
    prefix:   /admin/translations

Step 4: Override your Sonata Admin Layout

a) Set configuration:

# app/config/config.yml

sonata_admin:
    templates:
        # default global templates
        layout:  AcmeBundle:CRUD:layout.html.twig

b) Create template

{# AcmeBundle/Resources/views/CRUD/layout.html.twig #}

{% extends 'SonataAdminBundle::standard_layout.html.twig' %}

{% block side_bar_after_nav %}
    <ul class="sidebar-menu">
        <li>
            <a href="{{ path('jms_translation_index') }}">
                <i class="fa fa-angle-double-right"></i>
                <span>JMSTranslations</span>
            </a>
        </li>
    </ul>
{% endblock %}

Step 5:

Don't forget to configure you SonataAdminBundle and JMSTranslationBundle