You are here

public function HeartbeatCommentForm::buildForm in Heartbeat 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/HeartbeatCommentForm.php, line 43

Class

HeartbeatCommentForm
Class HeartbeatCommentForm.

Namespace

Drupal\heartbeat\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['comment_body'] = array(
    '#type' => 'textarea',
    '#title' => $this
      ->t('Comment Body'),
  );
  $form['post'] = array(
    '#type' => 'submit',
    '#description' => 'Comment',
    '#value' => t('Submit'),
    '#ajax' => [
      'callback' => '::commentAjaxSubmit',
      'progress' => array(
        'type' => 'throbber',
        'message' => t('Posting Comment'),
      ),
    ],
  );
  return $form;
}