MDL-66849 output: Remove custom menu title when not specified

This commit is contained in:
Michael Milette 2020-02-12 10:37:25 -05:00
parent df0e58adb1
commit 8056397b7e
3 changed files with 6 additions and 7 deletions

View File

@ -3763,11 +3763,10 @@ class custom_menu extends custom_menu_item {
$setting = trim($setting);
if (!empty($setting)) {
switch ($i) {
case 0:
case 0: // Menu text.
$itemtext = ltrim($setting, '-');
$itemtitle = $itemtext;
break;
case 1:
case 1: // URL.
try {
$itemurl = new moodle_url($setting);
} catch (moodle_exception $exception) {
@ -3776,10 +3775,10 @@ class custom_menu extends custom_menu_item {
$itemurl = null;
}
break;
case 2:
case 2: // Title attribute.
$itemtitle = $setting;
break;
case 3:
case 3: // Language.
if (!empty($language)) {
$itemlanguages = array_map('trim', explode(',', $setting));
$itemvisible &= in_array($language, $itemlanguages);

View File

@ -33,7 +33,7 @@
{{^divider}}
{{#haschildren}}
<li class="dropdown nav-item">
<a class="dropdown-toggle nav-link" id="drop-down-{{uniqid}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="#" aria-controls="drop-down-menu-{{uniqid}}">
<a class="dropdown-toggle nav-link" id="drop-down-{{uniqid}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="#" {{#title}}title="{{{title}}}"{{/title}} aria-controls="drop-down-menu-{{uniqid}}">
{{{text}}}
</a>
<div class="dropdown-menu" role="menu" id="drop-down-menu-{{uniqid}}" aria-labelledby="drop-down-{{uniqid}}">

View File

@ -321,7 +321,7 @@ EOF;
$itemurl = $item->get_url();
$this->assertTrue($itemurl instanceof moodle_url);
$this->assertEquals('http://moodle.org', $itemurl->out());
$this->assertEquals($item->get_text(), $item->get_title()); // Implicit title.
$this->assertNull($item->get_title()); // Implicit title.
/** @var custom_menu_item $item */
$item = array_shift($firstlevel);