public function EditForm::buildForm in Linkit 8.5
Same name and namespace in other branches
- 8.4 src/Form/Matcher/EditForm.php \Drupal\linkit\Form\Matcher\EditForm::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/ EditForm.php, line 40
Class
- EditForm
- Provides an edit form for matchers.
Namespace
Drupal\linkit\Form\MatcherCode
public function buildForm(array $form, FormStateInterface $form_state, ProfileInterface $linkit_profile = NULL, $plugin_instance_id = NULL) {
$this->linkitProfile = $linkit_profile;
$this->linkitMatcher = $this->linkitProfile
->getMatcher($plugin_instance_id);
$form += $this->linkitMatcher
->buildConfigurationForm($form, $form_state);
$form['actions'] = [
'#type' => 'actions',
];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Save changes'),
'#submit' => [
'::submitForm',
],
'#button_type' => 'primary',
];
$form['actions']['delete'] = [
'#type' => 'link',
'#title' => $this
->t('Delete'),
'#url' => Url::fromRoute('linkit.matcher.delete', [
'linkit_profile' => $this->linkitProfile
->id(),
'plugin_instance_id' => $this->linkitMatcher
->getUuid(),
]),
'#attributes' => [
'class' => [
'button',
'button--danger',
],
],
];
return $form;
}