Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

New answers tagged

2

This is fairly simple. First, create a your_module.links.menu.yml file in your custom module and add the following: your_module.admin: title: 'Add content' parent: system.admin_content url: internal:/node/add Clear cache and you're done!


0

Might be able to do a toString and if it's not actually a link that will come back empty {% if item.below and item.url and item.url.toString|length > 0 %}


0

Ok. It's resolved. I cleared the browsers cache in Safari under: Preferences/Privacy/Manage Website Data and there I searched for my site name, selected it and hit "remove all". Therefore I presume it was my Safari browser's cache.


0

This code will be work properly for printing separate URL and Title of the link field in twig. {{ content.field_link[0]['#url'] }} {{ content.field_link[0]['#title'] }}


2

I think this is what you are looking for. https://www.drupal.org/project/view_mode_page It will create viewable routes for view modes. Check the examples and readme. They will display on the page the way they are configured to display from the backend.


0

Your code seems to define some menu links. You have to return an array with all menu links you want to define, and there's no way to define multiple menu links using a parameter or similar. What you can do is to construct the array programmatically: $link_template = array( 'link_path' => 'myheader/config', 'link_title' => 'Header Settings', '...


0

Field group can create tab groups (horizontal and vertical) and tab elements on the same view mode. Than you are able to access each tab with a hash. The ID of each tab becomes the has anchor (#company etc). You have to setup the fields in 1 view mode and place them under the appropriate tabs. Here is a screenshot of how the setup should look.


0

No. When you're building links for D7's menu system, you'll need to specify the entire link array because you're creating link metadata here. If you're trying to keep your code DRY you could try to create a template array (or function) then copy/update as you needed new links, but you're probably doing just as much work for little/no performance gain or ...


0

It is not (yet) possible. See issue on drupal.org for link fields for example in menu link or redirect to: Allow multiple target entity types in the entity reference field.


0

The example above for hook_toolbar is almost perfect. I fixed it, see code below. You just have to remove the span on the Language : EN then the click functionality works perfectly. see my code: /** * Implements hook_toolbar(). */ function examplemodule_toolbar() { // Get languages, get current route. $current_language = \Drupal::languageManager()-&...


1

You need to add geo as an allowed scheme. See https://blog.werk21.de/en/2017/06/06/change-list-valid-uri-schemes-drupal-8 for details.


0

There are no built-in functions for client-side JS UI confirmation prompts. If you're want to rely on just Drupal core for node deletion prompts you can use the built-in deletion forms (assuming the user has permissions to access it) and use the destination query parameter to redirect the user back to where they need to be: $nid = 123; $return_path = '...


0

Just use Menu Item Role Access. It makes it much easier than writing code.


Top 50 recent answers are included