diff --git a/lib/Alchemy/Phrasea/Controller/Prod/RootController.php b/lib/Alchemy/Phrasea/Controller/Prod/RootController.php index 70890e219c..7e02f54ce8 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/RootController.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/RootController.php @@ -20,6 +20,8 @@ use Alchemy\Phrasea\Model\Repositories\FeedRepository; use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\SplFileInfo; use Symfony\Component\HttpFoundation\Request; +// use Alchemy\Phrasea\Plugin\ActionBarPluginInterface; + class RootController extends Controller { @@ -85,6 +87,22 @@ class RootController extends Controller /** @var \Closure $filter */ $filter = $this->app['plugin.filter_by_authorization']; + /* prepare work to extend whole taskbar... later + $menus = [ + 'push' => ['native'=>true, 'n'=>0], + 'tools' => ['native'=>true, 'n'=>0], + ]; + / ** @var ActionBarPluginInterface $plugin * / + foreach($filter('actionbar') as $kplugin=>$plugin) { + foreach($plugin->getActionBar() as $kmenu=>$menu) { + if(!array_key_exists($kmenu, $menus)) { + $menus[$kmenu] = ['native'=>false, 'n'=>0]; + } + $menus[$kmenu]['n']++; + } + } + */ + $plugins = [ 'workzone' => $filter('workzone'), 'actionbar' => $filter('actionbar'), diff --git a/templates/web/prod/toolbar.html.twig b/templates/web/prod/toolbar.html.twig index 83b72db148..9f169906ea 100644 --- a/templates/web/prod/toolbar.html.twig +++ b/templates/web/prod/toolbar.html.twig @@ -166,9 +166,7 @@ {% if action.icon %} {% endif %} - - {% set label = action.label %} - {% trans from plugin.PluginLocale %}label{% endtrans %} + {{ action.label|trans({}, plugin.PluginLocale) }} {% endfor %} @@ -201,9 +199,7 @@ {% if action.icon %} {% endif %} - - {% set label = action.label %} - {% trans from plugin.PluginLocale %}label{% endtrans %} + {{ action.label|trans({}, plugin.PluginLocale) }} {% endfor %} @@ -237,9 +233,7 @@ {% endif %} - - {% set label = action.label %} - {% trans from plugin.PluginLocale %}label{% endtrans %} + {{ action.label|trans({}, plugin.PluginLocale) }} {% endfor %} @@ -260,8 +254,7 @@ {% if action.icon %} {% endif %} - {% set label = action.label %} - {% trans from plugin.PluginLocale %}label{% endtrans %} + {{ action.label|trans({}, plugin.PluginLocale) }} {% if not (loop.last and loop.parent.loop.last) %} @@ -275,8 +268,7 @@ {% if action.icon %} {% endif %} - {% set label = action.label %} - {% trans from plugin.PluginLocale %}label{% endtrans %} + {{ action.label|trans({}, plugin.PluginLocale) }} {% else %} @@ -311,3 +303,11 @@ {% endif %} {% endblock %} + +{% block toolbarJS %} + {% if plugins.actionbar is not empty %} + {% for plugin in plugins.actionbar %} +{{ (plugin.JS|default(''))|raw }} + {% endfor %} + {% endif %} +{% endblock %} \ No newline at end of file