18.10.2016 Views

Drupal 7 Module Development

Create successful ePaper yourself

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

Installation Profiles<br />

'module' => 'system',<br />

'delta' => 'main',<br />

'theme' => 'bartik',<br />

'status' => 1,<br />

'weight' => 0,<br />

'region' => 'content',<br />

'pages' => '',<br />

'cache' => DRUPAL_NO_CACHE,<br />

),<br />

array(<br />

'module' => 'user',<br />

'delta' => 'login',<br />

'theme' => 'bartik',<br />

'status' => 1,<br />

'weight' => 0,<br />

'region' => 'sidebar_first',<br />

'pages' => '',<br />

'cache' => DRUPAL_NO_CACHE,<br />

),<br />

array(<br />

'module' => 'system',<br />

'delta' => 'management',<br />

'theme' => 'bartik',<br />

'status' => 1,<br />

'weight' => 1,<br />

'region' => 'sidebar_first',<br />

'pages' => '',<br />

'cache' => DRUPAL_NO_CACHE,<br />

),<br />

);<br />

$query = db_insert('block')->fields(array('module', 'delta',<br />

'theme', 'status', 'weight', 'region', 'pages', 'cache'));<br />

foreach ($values as $record) {<br />

$query->values($record);<br />

}<br />

$query->execute();<br />

}<br />

There is no API function to enable blocks. Here we have to add rows to the block<br />

table for each block we want to configure. In this case we enable the main content,<br />

the login form, and the site management block.<br />

[ 356 ]

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

Saved successfully!

Ooh no, something went wrong!