You are here

public function ErrorPageSettingsForm::buildForm in Apigee Edge 8

Form constructor.

Parameters

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

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfigFormBase::buildForm

File

src/Form/ErrorPageSettingsForm.php, line 49

Class

ErrorPageSettingsForm
Provides a form for saving the error page title and content.

Namespace

Drupal\apigee_edge\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('apigee_edge.error_page');
  $form['error_page'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Title and content displayed on error page'),
    '#collapsible' => FALSE,
  ];
  $form['error_page']['error_page_title'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Error page title'),
    '#default_value' => $config
      ->get('error_page_title'),
  ];
  $form['error_page']['error_page_content'] = [
    '#type' => 'text_format',
    '#title' => $this
      ->t('Error page content'),
    '#format' => $config
      ->get('error_page_content.format'),
    '#default_value' => $config
      ->get('error_page_content.value'),
  ];
  $form['error_page']['error_page_debug_messages'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Show debug messages.'),
    '#description' => $this
      ->t('If checked, additional debug messages will be displayed on the error page. This can be turned off on production.'),
    '#default_value' => $config
      ->get('error_page_debug_messages'),
  ];
  return parent::buildForm($form, $form_state);
}