- Integrate JMSTranslationBundle with SonataAdminBundle
- Provides add translation message form
- Invalidate cache from web-interface
- Remove translation from web-interface
Add KASonataAdminJMSTranslationBundle in your composer.json:
{
"require": {
"kluev-andrew/sonata-admin-jms-translations": "dev-master"
}
}
{
"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.
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 KA\SonataAdminJMSTranslationBundle\KASonataAdminJMSTranslationBundle(),
// ...
);
}
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
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 %}
Don't forget to configure you SonataAdminBundle and JMSTranslationBundle