1 system.admin.inc system_theme_settings($form, &$form_state, $key)

Form builder; display configuration for individual themes.

Parameters

$key: A theme name.

Return value

The form structure.:

See also

system_theme_settings_submit()

Related topics

File

core/modules/system/system.admin.inc, line 417
Admin page callbacks for the System module.

Code

function system_theme_settings($form, &$form_state, $key) {
  $themes = list_themes();

  // Inform the user if theme_debug is enabled.
  system_theme_debug_enabled_warning();

  $form['theme'] = array(
    '#type' => 'value',
    '#value' => $key,
  );

  // Create a list which includes the current theme and all its base themes.
  if (isset($themes[$key]->base_themes)) {
    $theme_keys = array_keys($themes[$key]->base_themes);
    $theme_keys[] = $key;
  }
  else {
    $theme_keys = array($key);
  }

  // Process the theme and all its base themes.
  foreach ($theme_keys as $theme) {
    // Include the theme-settings.php file.
    $theme_settings_path = backdrop_get_path('theme', $theme) . '/theme-settings.php';
    if (file_exists(BACKDROP_ROOT . '/' . $theme_settings_path)) {
      require_once BACKDROP_ROOT . '/' . $theme_settings_path;
      $form_state['build_info']['files'][] = $theme_settings_path;
    }

    // Call theme-specific settings.
    $function = $theme . '_form_system_theme_settings_alter';
    if (function_exists($function)) {
      $function($form, $form_state);
    }
  }

  if (isset($themes[$key]->info['settings']['color']) && !module_exists('color')) {
    // Notify the user that the theme supports the color module.
    backdrop_set_message(t('This theme supports custom color palettes. <a href="@url">Enable the Color module</a> to start customising it.', array(
      '@url' => url('admin/modules', array('query' => array('search' => 'color')))
    )), 'info');
  }

  // Add the submit button.
  $form['actions'] = array('#type' => 'actions');
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save theme settings'),
  );

  return $form;
}