'left', 'right' => 'right'));
$active_regions = array();
foreach ($regions_list as $region => $value) {
if (trim($region) == trim($value)) {
$active_regions[] = $region;
}
}
if (in_array($vars['block']->region, $active_regions)) {
$vars['template_files'] = array('block');
}
}
/**
* Implementation of template_preprocess_page()
*/
function accordion_blocks_preprocess_page(&$variables){
// to add the accordian effect add this parent div for the blocks
$regions_list = variable_get('accordion_regions',array('left' => 'left', 'right' => 'right'));
foreach ($regions_list as $region => $is_enabled) {
if (!empty($variables[$region]) && $is_enabled) {
$variables[$region] = '
'. $variables[$region] .'
';
}
}
}
function accordion_blocks_menu() {
//settings page
$items['admin/settings/accordion_blocks'] = array(
"title" => t("Accordion Blocks"),
"description" => t("Configure the Regions to apply Accordion effect."),
"page callback" => "drupal_get_form",
"page arguments" => array('accordion_blocks_settings_form'),
"access arguments" => array('administer site configuration'),
);
return $items;
}
function accordion_blocks_settings_form() {
$form = array();
global $user;
$themes = list_themes();
$theme = !empty($user->theme) && !empty($themes[$user->theme]->status) ? $user->theme : variable_get('theme_default', 'garland');
$theme = $custom_theme && $themes[$custom_theme] ? $custom_theme : $theme;
$regions_list = system_region_list($theme);
$form['accordion_regions'] = array(
'#type' => 'checkboxes',
'#title' => t('Select Regions to apply Accordion effect'),
'#options' => $regions_list,
'#default_value' => variable_get('accordion_regions',array('left' => 'left', 'right' => 'right')),
);
return system_settings_form($form);
}