Skip to content

Commit

Permalink
Added translation domain to batchActions
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Nov 6, 2015
1 parent 03f72ae commit ffe2736
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1158,8 +1158,9 @@ public function getBatchActions()

if ($this->hasRoute('delete') && $this->isGranted('DELETE')) {
$actions['delete'] = array(
'label' => $this->trans('action_delete', array(), 'SonataAdminBundle'),
'ask_confirmation' => true, // by default always true
'label' => 'action_delete',
'translation_domain' => 'SonataAdminBundle',
'ask_confirmation' => true, // by default always true
);
}

Expand Down
3 changes: 2 additions & 1 deletion Resources/doc/reference/batch_actions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ merges them onto a single target item. It should only be available when two cond
$this->hasRoute('delete') && $this->isGranted('DELETE')
) {
$actions['merge'] = array(
'label' => $this->trans('action_merge', array(), 'SonataAdminBundle'),
'label' => 'action_merge',
'translation_domain' => 'SonataAdminBundle'
'ask_confirmation' => true
);
Expand Down
2 changes: 1 addition & 1 deletion Resources/views/CRUD/base_list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ file that was distributed with this source code.

<select name="action" style="width: auto; height: auto" class="form-control">
{% for action, options in batchactions %}
<option value="{{ action }}">{{ options.label }}</option>
<option value="{{ action }}">{{ options.label|trans({}, options.translation_domain|default(admin.translationDomain)) }}</option>
{% endfor %}
</select>
{% endblock %}
Expand Down

0 comments on commit ffe2736

Please sign in to comment.