function template_preprocess_pagestyle_form in Page Style 7
Same name and namespace in other branches
- 6 includes/pagestyle.block.inc \template_preprocess_pagestyle_form()
Process variables for pagestyle-form.tpl.php.
The $variables array contains the following arguments:
- $list_inline: Display the ul list "inline" or not.
- $current_inline: Display the current page style "inline" or not.
- $current_pagestyle: The current page style.
- $display_current_pagestyle: Show or hide ("display_hidden") the text of the current page style.
- $display_current_pagestyle_text: Show or hide ("display_hidden").
- $pagestyle_form: The form.
- $current_pagestyle_text: The current page style text "Current Style" or "Current Theme".
- $pagestyle: The current page style (default Standard).
See also
pagestyle_theme(), pagestyle-form.tpl.php
File
- includes/
pagestyle.block.inc, line 595 - Block, page and theme functions.
Code
function template_preprocess_pagestyle_form(&$variables) {
$pagestyle_current_pagestyle_text = pagestyle_block_title($title = 'current');
$variables['pagestyle'] = array();
$hidden = array();
// Provide variables named after form keys so themers can print each element independently.
foreach (element_children($variables['form']) as $key) {
$type = $variables['form'][$key]['#type'];
if ($type == 'hidden' || $type == 'token') {
$hidden[] = drupal_render($variables['form'][$key]);
}
else {
$variables['pagestyle'][$key] = drupal_render($variables['form'][$key]);
}
}
$variables['list_inline'] = "list";
if (variable_get('pagestyle_display_list_inline', 0) == 1) {
$variables['list_inline'] = "inline";
}
$variables['current_inline'] = "pagestyle_current_list";
if (variable_get('pagestyle_display_current_inline', 0) == 1) {
$variables['current_inline'] = "pagestyle_current_inline";
}
$variables['current_pagestyle'] = NULL;
$variables['display_current_pagestyle'] = "display";
$variables['display_current_pagestyle_text'] = "display";
switch (variable_get('pagestyle_display_current_text_value', 'text_value')) {
case "text_value":
$variables['current_pagestyle'] = "current_pagestyle";
$variables['display_current_pagestyle'] = "display";
$variables['display_current_pagestyle_text'] = "display";
break;
case "value":
$variables['current_pagestyle'] = "current_pagestyle";
$variables['display_current_pagestyle'] = "display";
$variables['display_current_pagestyle_text'] = "display_hidden";
break;
case "hidden":
$variables['current_pagestyle'] = "current_pagestyle";
$variables['display_current_pagestyle'] = "display_hidden";
$variables['display_current_pagestyle_text'] = "display_hidden";
break;
case "remove":
$variables['display_current_pagestyle'] = "display_hidden";
$variables['display_current_pagestyle_text'] = "display_hidden";
break;
}
// Hidden form elements have no value to themers. No need for separation.
// $variables['pagestyle']['hidden'] = implode($hidden);
// Collect all form elements to make it easier to print the whole form.
$variables['pagestyle_form'] = implode($variables['pagestyle']);
$variables['current_pagestyle_text'] = $pagestyle_current_pagestyle_text;
$variables['pagestyle'] = pagestyle_get_current($value = 'name');
}