MDL-42629 actionmenu: alt and title on icon removed if the same as text being displayed

This commit is contained in:
Sam Hemelryk
2013-11-05 09:49:13 +08:00
parent 017518d4f8
commit cfd1e08a50
+10 -2
View File
@@ -1123,7 +1123,7 @@ class core_renderer extends renderer_base {
$text .= $this->render($action->text);
} else {
$text .= $action->text;
$comparetoalt = $action->text;
$comparetoalt = (string)$action->text;
}
$text .= html_writer::end_tag('span');
}
@@ -1134,9 +1134,17 @@ class core_renderer extends renderer_base {
if ($action->primary || !$action->actionmenu->will_be_enhanced()) {
$action->attributes['title'] = $action->text;
}
if ($icon->attributes['alt'] === $comparetoalt && $action->actionmenu->will_be_enhanced()) {
if ((string)$icon->attributes['alt'] === $comparetoalt && $action->actionmenu->will_be_enhanced()) {
$icon->attributes['alt'] = ' ';
}
if (!$action->primary && $action->actionmenu->will_be_enhanced()) {
if ((string)$icon->attributes['alt'] === $comparetoalt) {
$icon->attributes['alt'] = ' ';
}
if ((string)$icon->attributes['title'] === $comparetoalt) {
unset($icon->attributes['title']);
}
}
$icon = $this->render($icon);
}