function system_config_form

8.x system.module system_config_form($form, &$form_state)

Adds default behavior to a configuration form.

This includes a consistent 'Save configuration' button, theme definition, and submit handler.

Parameters

array $form: An associative array containing the structure of the form.

array $form_state: Reference to an associative array containing state of the form.

Return value

array The form structure.

See also

system_config_form_submit()

Related topics

1 call to system_config_form()
system_theme_settings in drupal/core/modules/system/system.admin.inc
Form builder; display theme configuration for entire site and individual themes.
1 string reference to 'system_config_form'
system_theme in drupal/core/modules/system/system.module
Implements hook_theme().

File

drupal/core/modules/system/system.module, line 3200
Configuration system that lets administrators modify the workings of the site.

Code

function system_config_form($form, &$form_state) {
  $form['actions']['#type'] = 'actions';
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
    '#button_type' => 'primary',
  );

  // Add system_config_form_submit() to output a consistent confirmation
  // message. Since this prevents drupal_prepare_form() from adding the form's
  // primary submit handler, do that first, using the same logic.
  if (!isset($form['#submit'])) {
    $form['#submit'] = array();
    if (isset($form_state['build_info']['callback_object'])) {
      $form['#submit'][] = array($form_state['build_info']['callback_object'], 'submitForm');
    }
    elseif (function_exists($form_state['build_info']['form_id'] . '_submit')) {
      $form['#submit'][] = $form_state['build_info']['form_id'] . '_submit';
    }
    elseif (isset($form_state['build_info']['base_form_id']) && function_exists($form_state['build_info']['base_form_id'] . '_submit')) {
      $form['#submit'][] = $form_state['build_info']['base_form_id'] . '_submit';
    }
  }
  $form['#submit'][] = 'system_config_form_submit';

  // By default, render the form using theme_system_config_form().
  if (!isset($form['#theme'])) {
    $form['#theme'] = 'system_config_form';
  }
  return $form;
}