18.10.2016 Views

Drupal 7 Module Development

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 12<br />

Each row being added to the block table contains the following information about<br />

the block:<br />

• module: The module that owns the block.<br />

• delta: The name of the block within the module.<br />

• theme: The theme the block will display within. Each theme has an<br />

individual block configuration.<br />

• status: When set to 1, the module is displayed.<br />

• weight: Used for ordering the block within a region. Larger weights are<br />

displayed below smaller weights.<br />

• region: The region in the page that the block will be displayed within.<br />

• pages: Any rules about the pages that the block will be displayed on.<br />

• cache: How the block will be cached.<br />

In <strong>Drupal</strong> 7, the sidebars were renamed for better<br />

multi-lingual support. What used to be the left sidebar<br />

is now sidebar_first and what used to be the right<br />

sidebar is now sidebar_second.<br />

Variable settings<br />

Installation profiles will often want to set their own variable settings, which are<br />

out-of-the-box, separate from those provided by <strong>Drupal</strong> core. <strong>Drupal</strong> provides the<br />

variable_set() function which can be used in an install task or in hook_install()<br />

to set a variable. For example, adding the following lines to store_install() will<br />

set the admin_theme to the Seven theme:<br />

function store_install() {<br />

...<br />

// Set the admin theme to seven.<br />

variable_set('admin_theme', 'seven');<br />

}<br />

[ 357 ]

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

Saved successfully!

Ooh no, something went wrong!