function color_form_system_theme_settings_alter

color_form_system_theme_settings_alter(&$form, FormStateInterface $form_state)

Implements hook_form_FORM_ID_alter().

File

core/modules/color/color.module, line 50
Allows users to change the color scheme of themes.

Code

function color_form_system_theme_settings_alter(&$form, FormStateInterface $form_state) {
  $build_info = $form_state->getBuildInfo();
  if (isset($build_info['args'][0]) && ($theme = $build_info['args'][0]) && color_get_info($theme) && function_exists('gd_info')) {
    $form['color'] = array(
      '#type' => 'details',
      '#title' => t('Color scheme'),
      '#open' => TRUE,
      '#weight' => -1,
      '#attributes' => array('id' => 'color_scheme_form'),
      '#theme' => 'color_scheme_form',
    );
    $form['color'] += color_scheme_form($form, $form_state, $theme);
    $form['#validate'][] = 'color_scheme_form_validate';
    // Ensure color submission happens first so we can unset extra values.
    array_unshift($form['#submit'], 'color_scheme_form_submit');
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!color!color.module/function/color_form_system_theme_settings_alter/8.1.x