Definition

color_form_alter($form_id, &$form)
color/color.module, line 18

Description

Implementation of hook_form_alter().

Code

<?php
function color_form_alter($form_id, &$form) {
  // Insert the color changer into the theme settings page.
  // TODO: Last condition in the following if disables color changer when private files are used this should be solved in a different way. See issue #92059.
  if ($form_id == 'system_theme_settings' && color_get_info(arg(4)) && function_exists('gd_info') && variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC) {
    $form['color'] = array(
      '#type' => 'fieldset',
      '#title' => t('Color scheme'),
      '#weight' => -1,
      '#attributes' => array('id' => 'color_scheme_form'),
      '#theme' => 'color_scheme_form',
    );
    $form['color'] += color_scheme_form(arg(4));
    $form['#submit']['color_scheme_form_submit'] = array();
  }

  // Use the generated screenshot in the theme list
  if ($form_id == 'system_theme_select_form' || $form_id == 'system_themes') {
    $themes = list_themes();
    foreach (element_children($form) as $theme) {
      if ($screenshot = variable_get('color_'. $theme .'_screenshot', NULL)) {
        if (isset($form[$theme]['screenshot'])) {
          $form[$theme]['screenshot']['#value'] = theme('image', $screenshot, '', '', array('class' => 'screenshot'), FALSE);
        }
      }
    }
  }
}
?>