Skip to content
Snippets Groups Projects

Issue #3495223: Improve UX for Local Tasks in Toolbar

Open Yannick requested to merge issue/admin_toolbar-3495223:3495223-improve-ux-for into 3.x
1 file
+ 12
2
Compare changes
  • Side-by-side
  • Inline
@@ -102,6 +102,16 @@ class AdminToolbarToolsHelper {
}
}
$local_tasks_default_url = Url::fromRoute('<none>');
$local_tasks_default_title = $this->t('Local Tasks');
// Set default URL to entity edit form if available.
foreach ($local_task_links['#links'] as $route_name => $link) {
if (preg_match('/^entity\..+\.edit_form$/', $route_name)) {
$local_tasks_default_url = $link['url'];
$local_tasks_default_title = $link['title'];
}
}
$build = [
'#type' => 'toolbar_item',
'#wrapper_attributes' => [
@@ -117,8 +127,8 @@ class AdminToolbarToolsHelper {
// This means that for now we always render Local Tasks item even
// when the tray is empty.
'#type' => 'link',
'#title' => $this->t('Local Tasks'),
'#url' => Url::fromRoute('<none>'),
'#title' => $local_tasks_default_title,
'#url' => $local_tasks_default_url,
'#attributes' => [
'class' => [
'toolbar-icon',
Loading