public static function ProfileHelper::installBlocks in Helper 7
File
- lib/
ProfileHelper.php, line 10
Class
Code
public static function installBlocks(array $blocks, $theme = NULL) {
if (!isset($theme)) {
$theme = variable_get('theme_default', 'bartik');
}
$query = db_insert('block');
$query
->fields(array(
'module',
'delta',
'theme',
'status',
'weight',
'region',
'visibility',
'pages',
'title',
'cache',
));
foreach ($blocks as $block) {
$block += array(
'theme' => $theme,
'status' => 1,
'weight' => 0,
'visibility' => BLOCK_VISIBILITY_NOTLISTED,
'pages' => '',
'title' => '',
'cache' => DRUPAL_NO_CACHE,
);
$query
->values($block);
}
if (!empty($blocks)) {
$query
->execute();
}
}