You are here

trait PluginFormTrait in Search API 8

Provides default implementations for plugin configuration forms.

Hierarchy

See also

\Drupal\Core\Plugin\PluginFormInterface

11 files declare their use of PluginFormTrait
AddHierarchy.php in src/Plugin/search_api/processor/AddHierarchy.php
Basic.php in src/Plugin/search_api/tracker/Basic.php
ContentEntity.php in src/Plugin/search_api/datasource/ContentEntity.php
Database.php in modules/search_api_db/src/Plugin/search_api/backend/Database.php
FieldsProcessorPluginBase.php in src/Processor/FieldsProcessorPluginBase.php

... See full list

File

src/Plugin/PluginFormTrait.php, line 14

Namespace

Drupal\search_api\Plugin
View source
trait PluginFormTrait {

  /**
   * Form validation handler.
   *
   * @param array $form
   *   An associative array containing the structure of the plugin form as built
   *   by static::buildConfigurationForm().
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the complete form.
   *
   * @see \Drupal\Core\Plugin\PluginFormInterface::validateConfigurationForm()
   */
  public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
  }

  /**
   * Form submission handler.
   *
   * @param array $form
   *   An associative array containing the structure of the plugin form as built
   *   by static::buildConfigurationForm().
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the complete form.
   *
   * @see \Drupal\Core\Plugin\PluginFormInterface::submitConfigurationForm()
   */
  public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {

    // @todo Clean this up once we depend on Drupal 9.0+.
    if ($this instanceof ConfigurableInterface || $this instanceof DrupalConfigurablePluginInterface) {
      $this
        ->setConfiguration($form_state
        ->getValues());
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PluginFormTrait::submitConfigurationForm public function Form submission handler. 7
PluginFormTrait::validateConfigurationForm public function Form validation handler. 2