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.

Chapter 8 ■ <strong>Drupal</strong> Blocks<br />

Figure 8-2. The “Block layout” page<br />

On the “Block layout” page you will see that <strong>Drupal</strong> 8 provides a number of prebuilt blocks that can be<br />

placed on pages on your site. Pick a few by selecting from the list of blocks in the “Place blocks” box in the<br />

right column of the page. Click the title of a block and, on the “Configure block” form, pick a region from the<br />

select list (e.g., Sidebar First if you are using the Bartik theme). After assigning the blocks to regions, click the<br />

“Save blocks” button. If you return to your site’s homepage, you’ll now see the blocks that you enabled in the<br />

regions where you assigned them.<br />

Rearranging Blocks<br />

It is likely that, at some point in time, you’re going to want to reorder how blocks appear on a page. In the<br />

previous example shown in Figure 8-1, we may want to have the “Recent content” and “Recent comments”<br />

blocks appear above the “Who’s new” block. To reorder the blocks, navigate to the “Block layout” page as<br />

described in the previous section. On the “Block layout” page, shown in Figure 8-2, simply click and hold the<br />

plus sign (+) next to the block that you want to move, and drag that block to the position where you want it<br />

in the list of blocks for that region. When you release the mouse button, you’ll see that <strong>Drupal</strong> reordered the<br />

items (temporarily). You’ll see a message at the top of the list of blocks stating “You have unsaved changes.”<br />

Scroll to the bottom of the page and click “Save blocks.” <strong>Drupal</strong> will save the changes and display a message<br />

stating that the changes were made. Return to the homepage by clicking the “Back to site” link at the top left<br />

of the page and you will see the blocks in their new order.<br />

Reassigning and Deactivating Blocks<br />

<strong>Drupal</strong> also provides the mechanisms for moving a block to a different region and deactivating a block that is<br />

already visible on a page. To make the changes, navigate to the “Block layout” page (Structure ➤<br />

Block layout).<br />

On the “Block layout” page (refer to Figure 8-2), click the Region drop-down list for one of the blocks<br />

you enabled and assigned to a region and select the option. Immediately upon selecting ,<br />

that item will disappear from the region section of the “Block layout” page and will reappear at the bottom<br />

of the page in the Disabled section. Next, click the Region drop-down list for another one of the blocks that<br />

you assigned to a region and select a different region from the select list. Immediately after selecting the new<br />

location, the block you selected will move to the newly assigned region within the block listing, and it will<br />

93

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

Saved successfully!

Ooh no, something went wrong!