You are here

public function UsermailDebuggerForm::buildForm in Mail Debugger 8

Build Form function.

Overrides FormInterface::buildForm

File

src/Form/UsermailDebuggerForm.php, line 89

Class

UsermailDebuggerForm
Class UsermailDebuggerForm.

Namespace

Drupal\mail_debugger\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  return [
    'user' => [
      '#title' => $this
        ->t("Send for"),
      '#type' => 'entity_autocomplete',
      '#target_type' => 'user',
      '#default_value' => $this->userStorage
        ->load($this->defaultsStorage
        ->get('user') ?? $this
        ->currentUser()
        ->id()),
      '#selection_handler' => 'default:user',
      '#selection_settings' => [
        'include_anonymous' => FALSE,
      ],
      '#required' => TRUE,
    ],
    'operation' => [
      '#title' => $this
        ->t("Subject"),
      '#type' => 'radios',
      '#options' => $this
        ->getOperations(),
      '#default_value' => $this->defaultsStorage
        ->get('operation'),
      '#required' => TRUE,
    ],
    'actions' => [
      '#type' => 'actions',
      'submit' => [
        '#type' => 'submit',
        '#value' => $this
          ->t("Send"),
      ],
    ],
  ];
}