![]() ![]() We looked at the hopefully familiar implementation of each of them from core's Node module. In this tutorial, we looked at the four major types of links we can provide from a custom module. Learn more about contextual links in Add a Contextual Link in a Module. Returning to the Node module for an example we can find the /core/modules/node/ file: _form: In addition to the YAML file a contextual link needs to add a #contextual_links element to the render array where the link needs to appear. ![]() These routes are listed in a YAML file with the. Contextual links should identify the particular route (named URL path) that will be used as contextual links. Contextual links provided by the Node module make that easier.Ĭontextual links, unlike the links we've looked at so far, are not only specified via a YAML file. For example, when viewing a node, common actions may include editing or deleting the content. Contextual linksĬontextual links provide shortcuts to common administrator tasks. Learn more about local task links in Add a Local Task Link in a Module. We can see that by looking at core/modules/node/. The Node module provides several local tasks. These links are also defined within a particularly named YAML file with the extension. If you've ever visited a node page and clicked on the edit link you've clicked a local task link to reach the edit form. Local tasks are by default rendered as tabs available to authenticated users. Learn more about action link options in Add an Action Link in a Module. Again using the Node module as an example, here is the contents of the /core/modules/node/ file: node.type_add: Actions are specified in yet another YAML file with a particular naming convention. An example of this can be seen on the content type administration screen ( /admin/structure/types) with the Add content type button. Action links allow module developers to provide particular actions for working with their data structures. While logged in as a site administrator, if you come across a link to Add something, chances are you're looking at an action link. Learn more about the various options for menu links in Add a Menu Link in a Module. entity.node_llection:ĭescription: 'Create and manage fields, forms, and display settings for your content.' For example, the Node module defines 2 menu links in the file core/modules/node/. You can identify them by looking for files that end with the extension. Browsing Drupal core you will see that several modules include menu links. From a high level these links are provided by custom modules by including a YAML file. If a module wants to add a link to a menu in Drupal, it can do so by providing a menu link. Learn the differences between the various types of links available to module developers and understand when to use each type of link. In this tutorial we'll provide an overview of the following concepts: ![]()
0 Comments
Leave a Reply. |