Loading src/GinNavigation.php +8 −2 Original line number Diff line number Diff line Loading @@ -87,9 +87,11 @@ class GinNavigation implements ContainerInjectionInterface { // support older PHP versions // for Druapl 9.0+. $create_type_items = []; $create_item_url = ''; // Get node types. if ($entity_type_manager->hasDefinition('node')) { $create_item_url = Url::fromRoute('node.add_page')->toString(); $content_types = $entity_type_manager->getStorage('node_type')->loadMultiple(); $content_type_items = []; Loading @@ -97,7 +99,7 @@ class GinNavigation implements ContainerInjectionInterface { $content_type_items[] = [ 'title' => $item->label(), 'class' => $item->id(), 'url' => Url::fromRoute('node.add', ['node_type' => $item->id()]), 'url' => $create_item_url, ]; } Loading Loading @@ -182,11 +184,15 @@ class GinNavigation implements ContainerInjectionInterface { ); } if (!$create_type_items && !$create_item_url) { return []; } // Generate menu items. $create_items['create'] = [ 'title' => t('Create'), 'class' => 'create', 'url' => Url::fromRoute('node.add_page')->toString(), 'url' => $create_item_url, 'below' => $create_type_items, ]; Loading templates/menu-region--middle.html.twig +9 −3 Original line number Diff line number Diff line Loading @@ -12,9 +12,15 @@ {% set item_class = 'toolbar-link--' ~ item.class|clean_class %} <li id="{{ item_id }}" class="{{ item.below ? 'toolbar-menu__item--has-dropdown' }} toolbar-menu__item toolbar-menu__item--level-1" data-url="{{ item.url }}"> {% if item.below is empty %} {% if item.url %} <a href="{{ item.url }}" class="toolbar-link toolbar-link--has-icon {{ item_class }}"> <span>{{ item.title }}</span> </a> {% else %} <button class="toolbar-link toolbar-link--has-icon {{ item_class }}"> <span>{{ item.title }}</span> </button> {% endif %} {% endif %} {% if item.below %} <button class="toolbar-link toolbar-link--has-icon {{ item_class }}"> Loading Loading
src/GinNavigation.php +8 −2 Original line number Diff line number Diff line Loading @@ -87,9 +87,11 @@ class GinNavigation implements ContainerInjectionInterface { // support older PHP versions // for Druapl 9.0+. $create_type_items = []; $create_item_url = ''; // Get node types. if ($entity_type_manager->hasDefinition('node')) { $create_item_url = Url::fromRoute('node.add_page')->toString(); $content_types = $entity_type_manager->getStorage('node_type')->loadMultiple(); $content_type_items = []; Loading @@ -97,7 +99,7 @@ class GinNavigation implements ContainerInjectionInterface { $content_type_items[] = [ 'title' => $item->label(), 'class' => $item->id(), 'url' => Url::fromRoute('node.add', ['node_type' => $item->id()]), 'url' => $create_item_url, ]; } Loading Loading @@ -182,11 +184,15 @@ class GinNavigation implements ContainerInjectionInterface { ); } if (!$create_type_items && !$create_item_url) { return []; } // Generate menu items. $create_items['create'] = [ 'title' => t('Create'), 'class' => 'create', 'url' => Url::fromRoute('node.add_page')->toString(), 'url' => $create_item_url, 'below' => $create_type_items, ]; Loading
templates/menu-region--middle.html.twig +9 −3 Original line number Diff line number Diff line Loading @@ -12,9 +12,15 @@ {% set item_class = 'toolbar-link--' ~ item.class|clean_class %} <li id="{{ item_id }}" class="{{ item.below ? 'toolbar-menu__item--has-dropdown' }} toolbar-menu__item toolbar-menu__item--level-1" data-url="{{ item.url }}"> {% if item.below is empty %} {% if item.url %} <a href="{{ item.url }}" class="toolbar-link toolbar-link--has-icon {{ item_class }}"> <span>{{ item.title }}</span> </a> {% else %} <button class="toolbar-link toolbar-link--has-icon {{ item_class }}"> <span>{{ item.title }}</span> </button> {% endif %} {% endif %} {% if item.below %} <button class="toolbar-link toolbar-link--has-icon {{ item_class }}"> Loading