You are here

public function MessageEditForm::form in Contact Storage 8

Gets the actual form array to be built.

Overrides ContentEntityForm::form

See also

\Drupal\Core\Entity\EntityForm::processForm()

\Drupal\Core\Entity\EntityForm::afterBuild()

File

src/MessageEditForm.php, line 16

Class

MessageEditForm
Form controller for contact message edit forms.

Namespace

Drupal\contact_storage

Code

public function form(array $form, FormStateInterface $form_state) {

  /** @var \Drupal\contact\MessageInterface $message */
  $message = $this->entity;
  $form = parent::form($form, $form_state);
  $form['name'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Author name'),
    '#maxlength' => 255,
    '#default_value' => $message
      ->getSenderName(),
  ];
  $form['mail'] = [
    '#type' => 'email',
    '#title' => $this
      ->t('Sender email address'),
    '#default_value' => $message
      ->getSenderMail(),
  ];
  return $form;
}