You are here

interface ExposedFormPluginInterface in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginInterface.php \Drupal\views\Plugin\views\exposed_form\ExposedFormPluginInterface
  2. 10 core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginInterface.php \Drupal\views\Plugin\views\exposed_form\ExposedFormPluginInterface

Interface for exposed filter form plugins.

Exposed form plugins handle the rendering, validation, and submission of exposed forms, and may add additional form elements. These plugins can also alter the view query. See \Drupal\views\Plugin\views\exposed_form\InputRequired as an example of that functionality.

Hierarchy

Expanded class hierarchy of ExposedFormPluginInterface

All classes that implement ExposedFormPluginInterface

See also

\Drupal\views\Annotation\ViewsExposedForm

\Drupal\views\Plugin\views\exposed_form\ExposedFormPluginBase

Related topics

1 file declares its use of ExposedFormPluginInterface
DisplayKernelTest.php in core/modules/views/tests/src/Kernel/Plugin/DisplayKernelTest.php

File

core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginInterface.php, line 42

Namespace

Drupal\views\Plugin\views\exposed_form
View source
interface ExposedFormPluginInterface extends ViewsPluginInterface {

  /**
   * Renders the exposed form.
   *
   * This method iterates over each handler configured to expose widgets
   * to the end user and attach those widgets to the exposed form.
   *
   * @param bool $block
   *   (optional) TRUE if the exposed form is being rendered as part of a
   *   block; FALSE (default) if not.
   *
   * @return array
   *   Form build array. This method returns an empty array if the form is
   *   being rendered as a block.
   *
   * @see \Drupal\views\ViewExecutable::build()
   */
  public function renderExposedForm($block = FALSE);

  /**
   * Runs before the view is rendered.
   *
   * Implement if your exposed form needs to run code before the view is
   * rendered.
   *
   * @param \Drupal\views\ResultRow[] $values
   *   An array of all ResultRow objects returned from the query.
   *
   * @see \Drupal\views\ViewExecutable::render()
   */
  public function preRender($values);

  /**
   * Runs after the view has been rendered.
   *
   * Implement if your exposed form needs to run code after the view is
   * rendered.
   *
   * @param string $output
   *   The rendered output of the view display.
   *
   * @see \Drupal\views\ViewExecutable::render()
   */
  public function postRender(&$output);

  /**
   * Runs before the view has been executed.
   *
   * Implement if your exposed form needs to run code before query execution.
   *
   * @see \Drupal\views\Plugin\views\display\DisplayPluginBase::preExecute()
   */
  public function preExecute();

  /**
   * Runs after the view has been executed.
   *
   * Implement if your exposed form needs to run code after query execution.
   */
  public function postExecute();

  /**
   * Alters the exposed form.
   *
   * The exposed form is built by calling the renderExposedForm() method on
   * this class, and then letting each exposed filter and sort handler add
   * widgets to the form. After that is finished, this method is called to
   * let the class alter the finished form.
   *
   * @param array $form
   *   An associative array containing the structure of the form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   *
   * @see \Drupal\views\Plugin\views\exposed_form\ExposedFormPluginInterface::renderExposedForm()
   * @see \Drupal\views\Form\ViewsExposedForm::buildForm()
   */
  public function exposedFormAlter(&$form, FormStateInterface $form_state);

  /**
   * Validates the exposed form submission.
   *
   * @param array $form
   *   An associative array containing the structure of the form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   *
   * @see \Drupal\views\Form\ViewsExposedForm::validateForm()
   */
  public function exposedFormValidate(&$form, FormStateInterface $form_state);

  /**
   * Submits the exposed form.
   *
   * @param array $form
   *   An associative array containing the structure of the form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   * @param array $exclude
   *   Array of keys that will not appear in $view->exposed_raw_input; for
   *   example, 'form_build_id'.
   *
   * @see \Drupal\views\Form\ViewsExposedForm::submitForm()
   */
  public function exposedFormSubmit(&$form, FormStateInterface $form_state, &$exclude);

}

Members

Namesort descending Modifiers Type Description Overrides
DerivativeInspectionInterface::getBaseId public function Gets the base_plugin_id of the plugin instance. 1
DerivativeInspectionInterface::getDerivativeId public function Gets the derivative_id of the plugin instance. 1
ExposedFormPluginInterface::exposedFormAlter public function Alters the exposed form. 1
ExposedFormPluginInterface::exposedFormSubmit public function Submits the exposed form. 1
ExposedFormPluginInterface::exposedFormValidate public function Validates the exposed form submission. 1
ExposedFormPluginInterface::postExecute public function Runs after the view has been executed. 1
ExposedFormPluginInterface::postRender public function Runs after the view has been rendered. 1
ExposedFormPluginInterface::preExecute public function Runs before the view has been executed. 1
ExposedFormPluginInterface::preRender public function Runs before the view is rendered. 1
ExposedFormPluginInterface::renderExposedForm public function Renders the exposed form. 1
PluginInspectionInterface::getPluginDefinition public function Gets the definition of the plugin implementation. 4
PluginInspectionInterface::getPluginId public function Gets the plugin_id of the plugin instance. 2
ViewsPluginInterface::buildOptionsForm public function Provide a form to edit options for this plugin. 1
ViewsPluginInterface::create public static function
ViewsPluginInterface::destroy public function Clears a plugin. 1
ViewsPluginInterface::filterByDefinedOptions public function Filter out stored options depending on the defined options. 1
ViewsPluginInterface::getAvailableGlobalTokens public function Returns an array of available token replacements. 1
ViewsPluginInterface::getProvider public function Returns the plugin provider. 1
ViewsPluginInterface::globalTokenForm public function Adds elements for available core tokens to a form. 1
ViewsPluginInterface::globalTokenReplace public function Returns a string with any core tokens replaced. 1
ViewsPluginInterface::init public function Initialize the plugin. 1
ViewsPluginInterface::pluginTitle public function Return the human readable name of the display. 1
ViewsPluginInterface::preRenderAddFieldsetMarkup public static function Moves form elements into fieldsets for presentation purposes. 1
ViewsPluginInterface::preRenderFlattenData public static function Flattens the structure of form elements. 1
ViewsPluginInterface::query public function Add anything to the query that we might need to. 1
ViewsPluginInterface::submitOptionsForm public function Handle any special handling on the validate form. 1
ViewsPluginInterface::summaryTitle public function Returns the summary of the settings in the display. 1
ViewsPluginInterface::themeFunctions public function Provide a full list of possible theme templates used by this style. 1
ViewsPluginInterface::unpackOptions public function Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away. 1
ViewsPluginInterface::usesOptions public function Returns the usesOptions property. 1
ViewsPluginInterface::validate public function Validate that the plugin is correct and can be saved. 1
ViewsPluginInterface::validateOptionsForm public function Validate the options form. 1