From 7e5a3958549a0846267092f4a7b8e891f0357c5a Mon Sep 17 00:00:00 2001 From: cescobedo Date: Thu, 28 May 2020 19:59:06 +0200 Subject: [PATCH] MDL-68861 core_contentbank: Fix translation in add button --- contentbank/classes/output/bankcontent.php | 2 +- contentbank/index.php | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/contentbank/classes/output/bankcontent.php b/contentbank/classes/output/bankcontent.php index b851222803f..93b512b534f 100644 --- a/contentbank/classes/output/bankcontent.php +++ b/contentbank/classes/output/bankcontent.php @@ -101,7 +101,7 @@ class bankcontent implements renderable, templatable { // The tools are displayed in the action bar on the index page. foreach ($this->toolbar as $tool) { // Customize the output of a tool, like dropdowns. - $method = 'export_tool_'.$tool['name']; + $method = 'export_tool_'.$tool['action']; if (method_exists($this, $method)) { $this->$method($tool); } diff --git a/contentbank/index.php b/contentbank/index.php index e4bb6d63515..5608a9a2b93 100644 --- a/contentbank/index.php +++ b/contentbank/index.php @@ -70,7 +70,12 @@ if (has_capability('moodle/contentbank:useeditor', $context)) { if (!empty($editabletypes)) { // Editor base URL. $editbaseurl = new moodle_url('/contentbank/edit.php', ['contextid' => $contextid]); - $toolbar[] = ['name' => get_string('add'), 'link' => $editbaseurl, 'dropdown' => true, 'contenttypes' => $editabletypes]; + $toolbar[] = [ + 'name' => get_string('add'), + 'link' => $editbaseurl, 'dropdown' => true, + 'contenttypes' => $editabletypes, + 'action' => 'add' + ]; } } @@ -80,7 +85,12 @@ if (has_capability('moodle/contentbank:upload', $context)) { $accepted = $cb->get_supported_extensions_as_string($context); if (!empty($accepted)) { $importurl = new moodle_url('/contentbank/upload.php', ['contextid' => $contextid]); - $toolbar[] = array('name' => get_string('upload', 'contentbank'), 'link' => $importurl, 'icon' => 'i/upload'); + $toolbar[] = [ + 'name' => get_string('upload', 'contentbank'), + 'link' => $importurl, + 'icon' => 'i/upload', + 'action' => 'upload' + ]; } }