function styleswitcher_config_theme in Style Switcher 7.2
Same name and namespace in other branches
- 6.2 styleswitcher.admin.inc \styleswitcher_config_theme()
Page callback: Constructs a form for a theme-specific styles settings.
Parameters
string $theme: Name of the theme to configure styles for.
See also
styleswitcher_config_theme_validate()
styleswitcher_config_theme_submit()
1 string reference to 'styleswitcher_config_theme'
- styleswitcher_menu in ./
styleswitcher.module - Implements hook_menu().
File
- ./
styleswitcher.admin.inc, line 83 - Styleswitcher configuration functionality.
Code
function styleswitcher_config_theme($form, &$form_state, $theme) {
$styles = styleswitcher_style_load_multiple($theme);
uasort($styles, 'styleswitcher_sort');
$options = array_fill_keys(array_keys($styles), '');
$form['theme_name'] = array(
'#type' => 'value',
'#value' => $theme,
);
$form['settings'] = array(
'#theme' => 'styleswitcher_admin_styles_table',
'#tree' => TRUE,
);
foreach ($styles as $name => $style) {
$form['settings']['weight'][$name] = array(
'#type' => 'weight',
'#title' => t('Weight for @label', array(
'@label' => $style['label'],
)),
'#title_display' => 'invisible',
'#delta' => _styleswitcher_weight_delta($theme),
'#default_value' => $style['weight'],
'#weight' => $style['weight'],
// Set special class for drag and drop updating.
'#attributes' => array(
'class' => array(
'styleswitcher-style-weight',
),
),
);
$form['settings']['name'][$name] = array(
'#theme' => 'styleswitcher_admin_style_overview',
'#style' => $style,
);
$form['settings']['label'][$name] = array(
'#markup' => check_plain($style['label']),
);
}
$form['settings']['enabled'] = array(
'#type' => 'checkboxes',
'#title' => t('Enabled'),
'#title_display' => 'invisible',
'#options' => $options,
'#default_value' => array_keys(styleswitcher_style_load_multiple($theme, array(
'status' => TRUE,
))),
);
$form['settings']['default'] = array(
'#type' => 'radios',
'#title' => t('Default'),
'#title_display' => 'invisible',
'#options' => $options,
'#default_value' => styleswitcher_default_style_key($theme),
);
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
return $form;
}