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

Form builder; display theme configuration for entire site and 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 416
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);
    }
  }

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

  return $form;
}