public function AddForm::buildForm in Linkit 8.4
Same name in this branch
- 8.4 src/Form/Attribute/AddForm.php \Drupal\linkit\Form\Attribute\AddForm::buildForm()
- 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/ Attribute/ AddForm.php, line 65 - Contains \Drupal\linkit\Form\Attribute\AddForm.
Class
- AddForm
- Provides a form to apply attributes to a profile.
Namespace
Drupal\linkit\Form\AttributeCode
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('Attributes'),
'description' => $this
->t('Description'),
];
$form['plugin'] = [
'#type' => 'tableselect',
'#header' => $header,
'#options' => $this
->buildRows(),
'#empty' => $this
->t('No attributes 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;
}