function ctools_stylizer_edit_style_form_default in Chaos Tool Suite (ctools) 7
Same name and namespace in other branches
- 6 includes/stylizer.inc \ctools_stylizer_edit_style_form_default()
The default stylizer style editing form.
Even when not using this, styles should call through to this form in their own edit forms.
1 string reference to 'ctools_stylizer_edit_style_form_default'
- ctools_stylizer_add_plugin_forms in includes/
stylizer.inc - Add wizard forms specific to a style base plugin.
File
- includes/
stylizer.inc, line 960 - Create customized CSS and images from palettes created by user input.
Code
function ctools_stylizer_edit_style_form_default($form, &$form_state) {
ctools_add_js('stylizer');
ctools_add_css('stylizer');
drupal_add_library('system', 'farbtastic');
$plugin =& $form_state['base_style_plugin'];
$settings =& $form_state['settings'];
$form['top box'] = array(
'#prefix' => '<div id="ctools-stylizer-top-box" class="clearfix">',
'#suffix' => '</div>',
);
$form['top box']['left'] = array(
'#prefix' => '<div id="ctools-stylizer-left-box">',
'#suffix' => '</div>',
);
$form['top box']['preview'] = array(
// We have a copy of the $form_state on $form because form theme functions
// do not get $form_state.
'#theme' => 'ctools_stylizer_preview_form',
'#form_state' => &$form_state,
);
$form['top box']['preview']['submit'] = array(
'#type' => 'submit',
'#value' => t('Preview'),
);
if (!empty($plugin['palette'])) {
$form['top box']['color'] = array(
'#type' => 'fieldset',
'#title' => t('Color scheme'),
'#attributes' => array(
'id' => 'ctools_stylizer_color_scheme_form',
'class' => array(
'ctools-stylizer-color-edit',
),
),
'#theme' => 'ctools_stylizer_color_scheme_form',
);
$form['top box']['color']['palette']['#tree'] = TRUE;
foreach ($plugin['palette'] as $key => $color) {
if (empty($settings['palette'][$key])) {
$settings['palette'][$key] = $color['default_value'];
}
$form['top box']['color']['palette'][$key] = array(
'#type' => 'textfield',
'#title' => $color['label'],
'#default_value' => $settings['palette'][$key],
'#size' => 8,
);
}
}
if (!empty($plugin['settings form']) && function_exists($plugin['settings form'])) {
$plugin['settings form']($form, $form_state);
}
if (!empty($form_state['owner info']['owner form']) && function_exists($form_state['owner info']['owner form'])) {
$form_state['owner info']['owner form']($form, $form_state);
}
return $form;
}