color_scheme_form
modules/color/color.module, строка 103
- Версии
- 5
color_scheme_form($theme)
- 6
color_scheme_form(&$form_state, $theme)
Конструктор формы. Возвращает форму конфигурирования.
Код
<?php
function color_scheme_form($theme) {
$base = drupal_get_path('module', 'color');
$info = color_get_info($theme);
// Add Farbtastic color picker
drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE);
drupal_add_js('misc/farbtastic/farbtastic.js');
// Add custom CSS/JS
drupal_add_css($base .'/color.css', 'module', 'all', FALSE);
drupal_add_js($base .'/color.js');
drupal_add_js(array('color' => array(
'reference' => color_get_palette($theme, true)
)), 'setting');
// See if we're using a predefined scheme
$current = implode(',', variable_get('color_'. $theme .'_palette', array()));
// Note: we use the original theme when the default scheme is chosen.
$current = isset($info['schemes'][$current]) ? $current : ($current == '' ? reset($info['schemes']) : '');
// Add scheme selector
$info['schemes'][''] = t('Custom');
$form['scheme'] = array(
'#type' => 'select',
'#title' => t('Color set'),
'#options' => $info['schemes'],
'#default_value' => $current,
);
// Add palette fields
$palette = color_get_palette($theme);
$names = array(
'base' => t('Base color'),
'link' => t('Link color'),
'top' => t('Header top'),
'bottom' => t('Header bottom'),
'text' => t('Text color')
);
$form['palette']['#tree'] = true;
foreach ($palette as $name => $value) {
$form['palette'][$name] = array(
'#type' => 'textfield',
'#title' => $names[$name],
'#default_value' => $value,
'#size' => 8,
);
}
$form['theme'] = array('#type' => 'value', '#value' => arg(4));
$form['info'] = array('#type' => 'value', '#value' => $info);
return $form;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии