function color_scheme_form

7.x color.module color_scheme_form($complete_form, &$form_state, $theme)
6.x color.module color_scheme_form(&$form_state, $theme)

Form callback. Returns the configuration form.

1 call to color_scheme_form()
color_form_alter in drupal-6.x/modules/color/color.module
Implementation of hook_form_alter().
2 string references to 'color_scheme_form'
color_form_alter in drupal-6.x/modules/color/color.module
Implementation of hook_form_alter().
color_theme in drupal-6.x/modules/color/color.module
Implementation of hook_theme().

File

drupal-6.x/modules/color/color.module, line 150

Code

function color_scheme_form(&$form_state, $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;
}