You are here

public function PetSettingsForm::buildForm in Previewable email templates 8

Same name and namespace in other branches
  1. 8.4 src/Form/PetSettingsForm.php \Drupal\pet\Form\PetSettingsForm::buildForm()
  2. 8.3 src/Form/PetSettingsForm.php \Drupal\pet\Form\PetSettingsForm::buildForm()

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 FormInterface::buildForm

File

src/Form/PetSettingsForm.php, line 34

Class

PetSettingsForm
Class PetSettingsForm. @package Drupal\pet\Form

Namespace

Drupal\pet\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $pet_logging = \Drupal::config('pet.settings')
    ->get('pet_logging');
  $form['logging'] = array(
    '#type' => 'details',
    '#title' => t('PET log settings'),
    '#open' => TRUE,
  );
  $options = array(
    0 => t('Log everything.'),
    1 => t('Log errors only.'),
    2 => t('No logging, display error on screen, useful for debugging.'),
  );
  $form['logging']['pet_logging'] = array(
    '#type' => 'radios',
    '#title' => t('Log setting'),
    '#options' => $options,
    '#default_value' => $pet_logging,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  return $form;
}