Skip to content
Snippets Groups Projects
Commit 9830a271 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2309501 by garphy | dawehner: Use plugin IDs instead of titles for toolbar classes.

parent a7364b37
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -80,60 +80,60 @@
/**
* Main menu icons.
*/
.toolbar-icon-content:before {
.toolbar-icon-system-admin-content:before {
background-image: url(../../../misc/icons/787878/file.svg);
}
.toolbar-icon-content:active:before,
.toolbar-icon-content.active:before {
.toolbar-icon-system-admin-content:active:before,
.toolbar-icon-system-admin-content.active:before {
background-image: url(../../../misc/icons/000000/file.svg);
}
.toolbar-icon-structure:before {
.toolbar-icon-system-admin-structure:before {
background-image: url(../../../misc/icons/787878/orgchart.svg);
}
.toolbar-icon-structure:active:before,
.toolbar-icon-structure.active:before {
.toolbar-icon-system-admin-structure:active:before,
.toolbar-icon-system-admin-structure.active:before {
background-image: url(../../../misc/icons/000000/orgchart.svg);
}
.toolbar-icon-appearance:before {
.toolbar-icon-system-themes-page:before {
background-image: url(../../../misc/icons/787878/paintbrush.svg);
}
.toolbar-icon-appearance:active:before,
.toolbar-icon-appearance.active:before {
.toolbar-icon-system-themes-page:active:before,
.toolbar-icon-system-themes-page.active:before {
background-image: url(../../../misc/icons/000000/paintbrush.svg);
}
.toolbar-icon-people:before {
.toolbar-icon-user-admin-account:before {
background-image: url(../../../misc/icons/787878/people.svg);
}
.toolbar-icon-people:active:before,
.toolbar-icon-people.active:before {
.toolbar-icon-user-admin-account:active:before,
.toolbar-icon-user-admin-account.active:before {
background-image: url(../../../misc/icons/000000/people.svg);
}
.toolbar-icon-extend:before {
.toolbar-icon-system-modules-list:before {
background-image: url(../../../misc/icons/787878/puzzlepiece.svg);
}
.toolbar-icon-extend:active:before,
.toolbar-icon-extend.active:before {
.toolbar-icon-system-modules-list:active:before,
.toolbar-icon-system-modules-list.active:before {
background-image: url(../../../misc/icons/000000/puzzlepiece.svg);
}
.toolbar-icon-configuration:before {
.toolbar-icon-system-admin-config:before {
background-image: url(../../../misc/icons/787878/wrench.svg);
}
.toolbar-icon-configuration:active:before,
.toolbar-icon-configuration.active:before {
.toolbar-icon-system-admin-config:active:before,
.toolbar-icon-system-admin-config.active:before {
background-image: url(../../../misc/icons/000000/wrench.svg);
}
.toolbar-icon-reports:before {
.toolbar-icon-system-admin-reports:before {
background-image: url(../../../misc/icons/787878/barchart.svg);
}
.toolbar-icon-reports:active:before,
.toolbar-icon-reports.active:before {
.toolbar-icon-system-admin-reports:active:before,
.toolbar-icon-system-admin-reports.active:before {
background-image: url(../../../misc/icons/000000/barchart.svg);
}
.toolbar-icon-help:before {
.toolbar-icon-help-main:before {
background-image: url(../../../misc/icons/787878/questionmark-disc.svg);
}
.toolbar-icon-help:active:before,
.toolbar-icon-help.active:before {
.toolbar-icon-help-main:active:before,
.toolbar-icon-help-main.active:before {
background-image: url(../../../misc/icons/000000/questionmark-disc.svg);
}
.toolbar .toolbar-bar .toolbar-icon:before {
......
......@@ -58,7 +58,7 @@ function testToolbarClasses() {
$this->assertNoText('No strings available.', 'Search found the menu item as untranslated.');
// Check that the class is on the item before we translate it.
$xpath = $this->xpath('//a[contains(@class, "icon-structure")]');
$xpath = $this->xpath('//a[contains(@class, "icon-system-admin-structure")]');
$this->assertEqual(count($xpath), 1, 'The menu item class ok before translation.');
// Translate the menu item.
......@@ -87,7 +87,7 @@ function testToolbarClasses() {
// Toolbar icons are included based on the presence of a specific class on
// the menu item. Ensure that class also exists for a translated menu item.
$xpath = $this->xpath('//a[contains(@class, "icon-structure")]');
$xpath = $this->xpath('//a[contains(@class, "icon-system-admin-structure")]');
$this->assertEqual(count($xpath), 1, 'The menu item class is the same.');
}
......
......@@ -461,9 +461,7 @@ function toolbar_menu_navigation_links(array $tree) {
$element->options['attributes']['id'] = 'toolbar-link-' . $id;
$element->options['attributes']['class'][] = 'toolbar-icon';
// @todo Change to use the plugin ID as class since titles might change.
// https://www.drupal.org/node/2310365
$element->options['attributes']['class'][] = 'toolbar-icon-' . strtolower(str_replace(' ', '-', $definition['title']));
$element->options['attributes']['class'][] = 'toolbar-icon-' . strtolower(str_replace(array('.', ' ', '_'), array('-', '-', '-'), $definition['id']));
$element->options['attributes']['title'] = String::checkPlain($link->getDescription());
}
return $tree;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment