function SearchPageFormBase::form
Same name in other branches
- 8.9.x core/modules/search/src/Form/SearchPageFormBase.php \Drupal\search\Form\SearchPageFormBase::form()
- 10 core/modules/search/src/Form/SearchPageFormBase.php \Drupal\search\Form\SearchPageFormBase::form()
- 11.x core/modules/search/src/Form/SearchPageFormBase.php \Drupal\search\Form\SearchPageFormBase::form()
Overrides EntityForm::form
File
-
core/
modules/ search/ src/ Form/ SearchPageFormBase.php, line 74
Class
- SearchPageFormBase
- Provides a base form for search pages.
Namespace
Drupal\search\FormCode
public function form(array $form, FormStateInterface $form_state) {
$form['label'] = [
'#type' => 'textfield',
'#title' => $this->t('Label'),
'#description' => $this->t('The label for this search page.'),
'#default_value' => $this->entity
->label(),
'#maxlength' => '255',
];
$form['id'] = [
'#type' => 'machine_name',
'#default_value' => $this->entity
->id(),
'#disabled' => !$this->entity
->isNew(),
'#maxlength' => 64,
'#machine_name' => [
'exists' => [
$this,
'exists',
],
],
];
$form['path'] = [
'#type' => 'textfield',
'#title' => $this->t('Path'),
'#field_prefix' => 'search/',
'#default_value' => $this->entity
->getPath(),
'#maxlength' => '255',
'#required' => TRUE,
];
$form['plugin'] = [
'#type' => 'value',
'#value' => $this->entity
->get('plugin'),
];
if ($this->plugin instanceof PluginFormInterface) {
$form += $this->plugin
->buildConfigurationForm($form, $form_state);
}
return parent::form($form, $form_state);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.