You are here

public function ConfigForm::buildForm in Nice messages 8.2

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/ConfigForm.php, line 39
Contains Drupal\nicemessages\Form\ConfigForm.

Class

ConfigForm
Class ConfigForm.

Namespace

Drupal\nicemessages\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('nicemessages.config');
  $form['activation_method'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Activation method'),
    '#description' => $this
      ->t('The settings <strong>On</strong> (1) and <strong>Off</strong> (2) are both global settings affecting all users including Anonoumus user, ignoring any user settings on user account profile forms.'),
    '#default_value' => $config
      ->get('activation_method'),
    '#options' => [
      'on' => $this
        ->t('On'),
      'off' => $this
        ->t('Off'),
    ],
  ];
  $form['position'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Message popup screen position'),
    '#description' => $this
      ->t('Choose where the popup messages should be displayed in the browser port view. The appending/prepending of multiple messages will automatically change regarding to your choosen position.'),
    '#default_value' => $config
      ->get('position'),
    '#options' => [
      'top-left' => $this
        ->t('top left'),
      'center' => $this
        ->t('top center'),
      'top-right' => $this
        ->t('top right'),
      'bottom-left' => $this
        ->t('bottom left'),
      'bottom-right' => $this
        ->t('bottom right'),
    ],
  ];
  return parent::buildForm($form, $form_state);
}