You are here

public function SearchPageAddForm::buildForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/search/src/Form/SearchPageAddForm.php \Drupal\search\Form\SearchPageAddForm::buildForm()
  2. 9 core/modules/search/src/Form/SearchPageAddForm.php \Drupal\search\Form\SearchPageAddForm::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 SearchPageFormBase::buildForm

File

core/modules/search/src/Form/SearchPageAddForm.php, line 17

Class

SearchPageAddForm
Provides a form for adding a search page.

Namespace

Drupal\search\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, $search_plugin_id = NULL) {
  $this->entity
    ->setPlugin($search_plugin_id);
  $definition = $this->entity
    ->getPlugin()
    ->getPluginDefinition();
  $this->entity
    ->set('label', $definition['title']);
  return parent::buildForm($form, $form_state);
}