You are here

public function WebhookAddForm::buildForm in Acquia Content Hub 8.2

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

modules/acquia_contenthub_publisher/src/Form/Webhook/WebhookAddForm.php, line 20

Class

WebhookAddForm
Class WebhookAddForm.

Namespace

Drupal\acquia_contenthub_publisher\Form\Webhook

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['url'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Webhook URL'),
    '#description' => $this
      ->t('Example: @url', [
      '@url' => Url::fromRoute('acquia_contenthub.webhook', [], [
        'absolute' => TRUE,
      ])
        ->toString(),
    ]),
    '#required' => TRUE,
  ];
  $form['submit'] = [
    '#type' => 'submit',
    '#button_type' => 'primary',
    '#value' => $this
      ->t('Add Webhook'),
  ];
  return $form;
}