You are here

public function BroadcastForm::buildForm in Node.js integration 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

nodejs_notify/src/Form/BroadcastForm.php, line 23

Class

BroadcastForm
Class BroadcastForm

Namespace

Drupal\nodejs_notify\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['broadcast_form'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Broadcast Notification'),
  ];
  $form['broadcast_form']['broadcast_subject'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Broadcast notification subject'),
    '#required' => TRUE,
  ];
  $form['broadcast_form']['broadcast_message'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Broadcast notification message'),
    '#required' => TRUE,
  ];
  $form['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Broadcast'),
  ];
  return $form;
}