1 form_test.module form_test_system_config_form()

A form to test system_settings_form().

File

core/modules/simpletest/tests/form_test.module, line 2565
Helper module for the Form API tests.

Code

function form_test_system_config_form() {
  $config = config('simpletest.testconfig');
  $form['#config'] = 'simpletest.testconfig';
  $form['abc'] = array(
    '#type' => 'textfield',
    '#title' => 'abc',
    '#default_value' => $config->get('abc'),
  );
  $form['def'] = array(
    '#type' => 'textfield',
    '#title' => 'def',
    '#default_value' => $config->get('def'),
  );

  // Test single-element overrides.
  $system_config = config('system.core');
  $form['rss_description'] = array(
    '#type' => 'textfield',
    '#title' => 'xyz',
    '#default_value' => $system_config->get('rss_description'),
    '#config' => 'system.core',
  );

  // Test fieldsets of overrides.
  $second_config = config('simpletest.secondconfig');
  $form['second_settings'] = array(
    '#type' => 'fieldset',
    '#title' => 'Second Settings',
    '#config' => 'simpletest.secondconfig',
  );
  $form['second_settings']['ghi'] = array(
    '#type' => 'textfield',
    '#title' => 'ghi',
    '#default_value' => $second_config->get('ghi')
  );
  $form['second_settings']['jkl'] = array(
    '#type' => 'textfield',
    '#title' => 'jkl',
    '#default_value' => $second_config->get('jkl')
  );

  return system_settings_form($form);
}