18.11.2015 Views

Beginning Drupal 8

Todd Tomlinson - Beginning Drupal 8 (The Expert's Voice in Drupal) - 2015

Todd Tomlinson - Beginning Drupal 8 (The Expert's Voice in Drupal) - 2015

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Adding an Item to a Menu<br />

Chapter 7 ■ Creating Menus<br />

There are two general items that we can add to our page as menu items: a link to an existing element on our<br />

site (a page, a content item, a list of content associated with a taxonomy term, and so on), or a link to a page<br />

that is external to our site (e.g., www.drupal.org).<br />

Adding a Content Item to a Menu<br />

There are two approaches for adding items to menus:<br />

• The best practice is to use the content creation form (see Figure 7-2) or, as we will<br />

see later in the book, other element creation forms such as a panel page or a view.<br />

The reason for using this approach is that when you delete that content item, <strong>Drupal</strong><br />

automatically removes the item from the menu to which it was assigned. If you use<br />

the manual approach of creating a menu item using the menu administration form,<br />

you as the site owner must remember to remove that item manually from the menu<br />

• You can also use the menu administration form (see Figure 7-3) to create a new<br />

menu item, or you can create a menu link from the content item that you wish to<br />

reference from within the form used to create or edit that content item...<br />

Figure 7-2. Adding a content item to a menu<br />

To create a new content item, click any of the “Add content” links that are available on the homepage<br />

of your website (assuming you are still logged in as the administrator), and select the “Basic page” content<br />

type. As an example, enter a title and body for the new content type and then click the Menu Settings link in<br />

the right column. Check the “Provide a menu link” box, which reveals the fields for defining your menu (see<br />

Figure 7-2). Enter the title for the item as you wish it to appear on the menu, and in the “Parent item” dropdown<br />

list select the “Main navigation” menu as the one where you want the item to appear. After entering<br />

the values for your menu item, click the “Save and publish” button at the bottom of the page. <strong>Drupal</strong> then<br />

displays the page that you just created, with the menu item associated with this page now appearing in the<br />

Main navigation menu at the top left of the header area of the page.<br />

85

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!