You are here

public function AddForm::buildForm in Linkit 8.5

Same name and namespace in other branches
  1. 8.4 src/Form/Matcher/AddForm.php \Drupal\linkit\Form\Matcher\AddForm::buildForm()

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/Matcher/AddForm.php, line 61

Class

AddForm
Provides a form to apply matchers to a profile.

Namespace

Drupal\linkit\Form\Matcher

Code

public function buildForm(array $form, FormStateInterface $form_state, ProfileInterface $linkit_profile = NULL) {
  $this->linkitProfile = $linkit_profile;
  $form['#attached']['library'][] = 'linkit/linkit.admin';
  $header = [
    'label' => $this
      ->t('Matchers'),
  ];
  $form['plugin'] = [
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $this
      ->buildRows(),
    '#empty' => $this
      ->t('No matchers available.'),
    '#multiple' => FALSE,
  ];
  $form['actions'] = [
    '#type' => 'actions',
  ];
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Save and continue'),
    '#submit' => [
      '::submitForm',
    ],
    '#tableselect' => TRUE,
    '#button_type' => 'primary',
  ];
  return $form;
}