You are here

public function SendTestMessageForm::buildForm in Slack 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/SendTestMessageForm.php, line 51

Class

SendTestMessageForm
Class SendTestMessageForm.

Namespace

Drupal\slack\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('slack.settings');
  $form['slack_test_channel'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Channel or username'),
    '#default_value' => $config
      ->get('slack_channel'),
  ];
  $form['slack_test_message'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Message'),
    '#required' => TRUE,
  ];
  $form['actions']['#type'] = 'actions';
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Send message'),
    '#button_type' => 'primary',
  ];
  return $form;
}