You are here

interface ViewsPluginInterface in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/ViewsPluginInterface.php \Drupal\views\Plugin\views\ViewsPluginInterface

Provides an interface for all views plugins.

Hierarchy

Expanded class hierarchy of ViewsPluginInterface

All classes that implement ViewsPluginInterface

1 file declares its use of ViewsPluginInterface
ExposedFormPluginInterface.php in core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginInterface.php

File

core/modules/views/src/Plugin/views/ViewsPluginInterface.php, line 15

Namespace

Drupal\views\Plugin\views
View source
interface ViewsPluginInterface extends PluginInspectionInterface, DerivativeInspectionInterface {

  /**
   * Returns the plugin provider.
   *
   * @return string
   */
  public function getProvider();

  /**
   * Return the human readable name of the display.
   *
   * This appears on the ui beside each plugin and beside the settings link.
   */
  public function pluginTitle();

  /**
   * Returns the usesOptions property.
   */
  public function usesOptions();

  /**
   * Filter out stored options depending on the defined options.
   *
   * @param array $storage
   *   The stored options.
   */
  public function filterByDefinedOptions(array &$storage);

  /**
   * Validate the options form.
   */
  public function validateOptionsForm(&$form, FormStateInterface $form_state);

  /**
   * Returns the summary of the settings in the display.
   */
  public function summaryTitle();

  /**
   * Moves form elements into fieldsets for presentation purposes.
   *
   * Many views forms use #tree = TRUE to keep their values in a hierarchy for
   * easier storage. Moving the form elements into fieldsets during form
   * building would break up that hierarchy. Therefore, we wait until the
   * pre_render stage, where any changes we make affect presentation only and
   * aren't reflected in $form_state->getValues().
   *
   * @param array $form
   *   The form build array to alter.
   *
   * @return array
   *   The form build array.
   */
  public static function preRenderAddFieldsetMarkup(array $form);

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition);

  /**
   * Initialize the plugin.
   *
   * @param \Drupal\views\ViewExecutable $view
   *   The view object.
   * @param \Drupal\views\Plugin\views\display\DisplayPluginBase $display
   *   The display handler.
   * @param array $options
   *   The options configured for this plugin.
   */
  public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL);

  /**
   * Handle any special handling on the validate form.
   */
  public function submitOptionsForm(&$form, FormStateInterface $form_state);

  /**
   * Adds elements for available core tokens to a form.
   *
   * @param array $form
   *   The form array to alter, passed by reference.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   */
  public function globalTokenForm(&$form, FormStateInterface $form_state);

  /**
   * Returns an array of available token replacements.
   *
   * @param bool $prepared
   *   Whether to return the raw token info for each token or an array of
   *   prepared tokens for each type. E.g. "[view:name]".
   * @param array $types
   *   An array of additional token types to return, defaults to 'site' and
   *   'view'.
   *
   * @return array
   *   An array of available token replacement info or tokens, grouped by type.
   */
  public function getAvailableGlobalTokens($prepared = FALSE, array $types = []);

  /**
   * Flattens the structure of form elements.
   *
   * If a form element has #flatten = TRUE, then all of its children get moved
   * to the same level as the element itself. So $form['to_be_flattened'][$key]
   * becomes $form[$key], and $form['to_be_flattened'] gets unset.
   *
   * @param array $form
   *   The form build array to alter.
   *
   * @return array
   *   The form build array.
   */
  public static function preRenderFlattenData($form);

  /**
   * Returns a string with any core tokens replaced.
   *
   * @param string $string
   *   The string to preform the token replacement on.
   * @param array $options
   *   An array of options, as passed to \Drupal\Core\Utility\Token::replace().
   *
   * @return string
   *   The tokenized string.
   */
  public function globalTokenReplace($string = '', array $options = []);

  /**
   * Clears a plugin.
   */
  public function destroy();

  /**
   * Validate that the plugin is correct and can be saved.
   *
   * @return
   *   An array of error strings to tell the user what is wrong with this
   *   plugin.
   */
  public function validate();

  /**
   * Add anything to the query that we might need to.
   */
  public function query();

  /**
   * Unpack options over our existing defaults, drilling down into arrays
   * so that defaults don't get totally blown away.
   */
  public function unpackOptions(&$storage, $options, $definition = NULL, $all = TRUE, $check = TRUE);

  /**
   * Provide a form to edit options for this plugin.
   */
  public function buildOptionsForm(&$form, FormStateInterface $form_state);

  /**
   * Provide a full list of possible theme templates used by this style.
   */
  public function themeFunctions();

}

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
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