1.12. Menus dans Drupal
Drupal, like many other CMS, allows you to combine links to pages in the menu. You can add new menus and links to them when creating new pages.
After installing the standard version of Drupal, we have 5 menus.
Main navigation - this is the previous menu from Drupal 7 main-menu (primary links). By default, there is a link to the home page.
User account menu - This is a menu from Drupal 7 user-menu. Here are links to your personal account and exit from it.
Tools - menu with links to content management.
Footer - menu for the footer of the page, by default there is a link to the contact form.
Administration - a large menu duplicating the top menu of the administrator.
The menu in the Drupal is displayed in the form of a block, blocks can be displayed on the block layout control - Structure - Block layout:
You can add new menus, for this go to the page Manage - Structure - Menus and click the add menu button:
/admin/structure/menu/add
Now let's add a link to the menu, and for this we will create an article
/node/add/article
If you go to the article creation page, then there you will see that you have no way to add a link to our new menu. In order to add a link to this menu, you need to add the ability to add articles to this menu in the setting of the content type Article:
We go into editing the content type. Article and add our menu there:
/admin/structure/types/manage/article
Now, when creating an article, we can select our menu:
/node/add /article
Now that we have a menu with a link, let's display it in blocks:
/admin/structure/block
Now our menu is displayed on all pages.
Drupal, comme beaucoup d'autres CMS, permet de regrouper des liens vers des pages dans un menu. Vous pouvez ajouter de nouveaux menus et des liens vers ceux-ci lors de la création de nouvelles pages.
Après l'installation de la version standard de Drupal, nous disposons de 5 menus.
Navigation principale – c’est l’ancien menu de Drupal 7 main-menu (liens primaires). Par défaut, il contient un lien vers la page d'accueil.
Menu du compte utilisateur – c’est le menu user-menu de Drupal 7. Il contient les liens vers votre compte personnel et pour se déconnecter.
Outils – menu avec des liens vers la gestion du contenu.
Pied de page – menu pour le pied de page, par défaut il y a un lien vers le formulaire de contact.
Administration – un grand menu qui duplique le menu supérieur de l’administrateur.
Le menu dans Drupal s'affiche sous forme de bloc, les blocs peuvent être affichés et gérés via la gestion des blocs - Structure - Disposition des blocs :
Vous pouvez ajouter de nouveaux menus, pour cela rendez-vous dans Gérer - Structure - Menus et cliquez sur le bouton Ajouter un menu :
/admin/structure/menu/add
Ajoutons maintenant un lien au menu, pour cela nous allons créer un article :
/node/add/article
Si vous allez sur la page de création d’article, vous verrez que vous n’avez pas la possibilité d’ajouter un lien vers notre nouveau menu. Pour pouvoir ajouter un lien dans ce menu, il faut activer cette possibilité dans les paramètres du type de contenu Article :
Nous entrons dans la modification du type de contenu Article et ajoutons notre menu :
/admin/structure/types/manage/article
Maintenant, lors de la création d’un article, nous pouvons sélectionner notre menu :
/node/add/article
Maintenant que nous avons un menu avec un lien, affichons-le dans les blocs :
/admin/structure/block
Notre menu est maintenant affiché sur toutes les pages.