You are here

public function ForwardEmailForm::buildForm in Social media share 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 FormInterface::buildForm

File

src/Form/ForwardEmailForm.php, line 100

Class

ForwardEmailForm
Class ForwardEmailForm.

Namespace

Drupal\social_media\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['email'] = [
    '#type' => 'email',
    '#title' => $this
      ->t('Email address'),
    '#required' => TRUE,
    '#description' => $this
      ->t('The person email address whom you want to send'),
  ];
  $form['subject'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Subject'),
    '#required' => TRUE,
    '#default_value' => $this->requestStack
      ->getCurrentRequest()
      ->get('subject'),
  ];
  $form['body'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Body'),
    '#required' => TRUE,
    '#default_value' => $this->requestStack
      ->getCurrentRequest()
      ->get('body'),
  ];
  $form['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Send'),
  ];
  return $form;
}