function zenophile_sidebars_zenophile_alter in Zenophile 7
Same name and namespace in other branches
- 6.2 zenophile_sidebars/zenophile_sidebars.module \zenophile_sidebars_zenophile_alter()
Implements hook_zenophile_alter() (a Zenophile hook).
File
- zenophile_sidebars/
zenophile_sidebars.module, line 69 - Adds controls to adjust the width and placement of the sidebars and page in themes created with Zenophile.
Code
function zenophile_sidebars_zenophile_alter(&$files, $info) {
if ($info['form_values']['sidebars_on']) {
// Which sidebars.css template are we going to copy?
$files['css/sidebars.css'] = array(
// Dictating a file name like this would normally be hella insecure, but
// FAPI will limit the available choices to those that were in the form we
// created.
'from' => drupal_get_path('module', 'zenophile_sidebars') . "/css/sidebars-{$info['form_values']['sidebar-pos']}-{$info['form_values']['layout']}.css",
'type' => 'file',
'weight' => 61000,
);
$page = intval($info['form_values']['page']);
$ls = intval($info['form_values']['sidebar-left']);
$rs = intval($info['form_values']['sidebar-right']);
$ls_content_width = $page - $ls;
$rs_content_width = $page - $rs;
$both_sidebars_width = $ls + $rs;
$both_content_width = $page - $both_sidebars_width;
$files['css/sidebars.css']['repl'] = array(
'/PAGE/' => $page,
'/LSB-SB/' => $ls,
'/RSB-SB/' => $rs,
'/BOTHSB-SB/' => $both_sidebars_width,
'/LSB-CONTENT/' => $ls_content_width,
'/RSB-CONTENT/' => $rs_content_width,
'/BOTHSB-CONTENT/' => $both_content_width,
);
// Add sidebars.css to the .info file's list
// Note we're using tildes in the regex in the key because a key using
// slashes may have been set in zenophile.module when the option to add a
// fresh stylesheet is chosen, and we don't want to clobber that.
$files[$info['t_name'] . '.info']['repl']['~^; Add conditional stylesheets that are processed by IE\\.~m'] = "; Customized sidebar/content widths and positions\n\nstylesheets[all][] = css/sidebars.css\n\n; Add conditional stylesheets that are processed by IE.";
}
}