New answers tagged

1

The HTML code for the menu was: <ul class="menu"> <li> <a href="/contact">Contact</a> </li> <li> <a href="/faq">FAQ</a> </li> </ul> In the CSS file of my theme, I found ul.menu but also ul.inline. Once replaced .menu by .inline in my browser inspector, I had what I expected. So I digged -...


1

Use /admin/config/regional/language/detection to set how language is detected. Add the language switcher module someplace to let a user change language. I find that when I switch a language, menu items adjust to the current language. So create the menu item to /somelink and change my language to Japanese, change the link to /ja/somelink when the menu ...


0

Overide the menu.html.twig and Remove that line {% set link_attributes = link_attributes.addClass('dropdown-toggle').setAttribute('data-toggle', 'dropdown') %} with {% set link_attributes = link_attributes.addClass('dropdown-toggle').removeAttribute('data-toggle', 'dropdown') %} i.e setAttribute('data-toggle', 'dropdown') to removeAttribute('data-...


0

It's very simple to create the tree structure output you're looking for: Create the Content type Views, add the Taxonomy term Field next to the Title field, under Format Views settings choose to group by the Taxonomy field Grouping field Nr.1 On the Taxonomy field choose Exclude from display. This will give you a list of nodes that are displayed in ...


0

I have a view set up that sounds similar to what I think you are trying to accomplish: Create your content view filtering by taxonomy. Create your taxonomy view. Go back to your content view and use "no results behavior" under "advanced" and insert your taxonomy view into your content view as a "global view area". Now where there is no content assigned ...


0

That's probably an opinion-based thing and actually also a too broad question. But here's what I'd do: Programmatically create a new block. Provide a hook_theme and your own template to later render the output the way you want. Follow one answer from How to get all node entities tagged with a specific term? to get the data you need. In the block's build() ...


0

Given the answer you mentioned, I assume that you would like to retrieve your items data programmatically. What you are missing is the setRoot() method from MenuTreeParameters (here). Here is how you could start with: $menuTree = \Drupal::menuTree(); $menuTreeParameters = new MenuTreeParameters(); // This will fetch the tree starting from ...


0

You can do this by configuring the Menu levels on your Menu Block and placing that Block in a region of your theme. Additionally configure the Visibility of the block so it only appears on pages where you want it. You can learn more about the Menu levels configuration here: Drupal 8 Navigation Menu Blocks configuration. In your case you want the Initial ...


0

There are features in Views concerning taxonomy hierarchy, displaying terms with depth, you should look into it. There is also Group by field option under Format in Views where you can, for example, group by Parent field (Parent of the Taxonomy term). You may need to add a Relationship for the Taxonomy field first before you can see those extra Fields/...


0

The correct way to alter contextual links is to use hook_contextual_links_alter. In your case, it should look something like: function my_module_contextual_links_alter(array &$links, $group, array $route_parameters) { if ($group === 'block') { // Hide Configure Block option. unset($links['entity.block.edit_form']); } } The contextual links ...


0

Adding this code in Drupal/core/modules/menu_link_content/Plugin/Menu/MenuLinkContent.php made the functionality work exactly as expected. (Menu items were disabled in one language but enabled in another) public function isEnabled() { if ($this->languageManager->isMultilingual()) { return $this->getEntity()->isEnabled(); ...


Top 50 recent answers are included