3 namespace Drupal\views\Plugin\views;
5 use Drupal\Component\Plugin\DerivativeInspectionInterface;
6 use Drupal\Component\Plugin\PluginInspectionInterface;
7 use Drupal\Core\Form\FormStateInterface;
8 use Drupal\views\Plugin\views\display\DisplayPluginBase;
9 use Drupal\views\ViewExecutable;
10 use Symfony\Component\DependencyInjection\ContainerInterface;
13 * Provides an interface for all views plugins.
15 interface ViewsPluginInterface extends PluginInspectionInterface, DerivativeInspectionInterface {
18 * Returns the plugin provider.
22 public function getProvider();
25 * Return the human readable name of the display.
27 * This appears on the ui beside each plugin and beside the settings link.
29 public function pluginTitle();
32 * Returns the usesOptions property.
34 public function usesOptions();
37 * Filter out stored options depending on the defined options.
39 * @param array $storage
42 public function filterByDefinedOptions(array &$storage);
45 * Validate the options form.
47 public function validateOptionsForm(&$form, FormStateInterface $form_state);
50 * Returns the summary of the settings in the display.
52 public function summaryTitle();
55 * Moves form elements into fieldsets for presentation purposes.
57 * Many views forms use #tree = TRUE to keep their values in a hierarchy for
58 * easier storage. Moving the form elements into fieldsets during form
59 * building would break up that hierarchy. Therefore, we wait until the
60 * pre_render stage, where any changes we make affect presentation only and
61 * aren't reflected in $form_state->getValues().
64 * The form build array to alter.
67 * The form build array.
69 public static function preRenderAddFieldsetMarkup(array $form);
74 public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition);
77 * Initialize the plugin.
79 * @param \Drupal\views\ViewExecutable $view
81 * @param \Drupal\views\Plugin\views\display\DisplayPluginBase $display
82 * The display handler.
83 * @param array $options
84 * The options configured for this plugin.
86 public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL);
89 * Handle any special handling on the validate form.
91 public function submitOptionsForm(&$form, FormStateInterface $form_state);
94 * Adds elements for available core tokens to a form.
97 * The form array to alter, passed by reference.
98 * @param \Drupal\Core\Form\FormStateInterface $form_state
99 * The current state of the form.
101 public function globalTokenForm(&$form, FormStateInterface $form_state);
104 * Returns an array of available token replacements.
106 * @param bool $prepared
107 * Whether to return the raw token info for each token or an array of
108 * prepared tokens for each type. E.g. "[view:name]".
109 * @param array $types
110 * An array of additional token types to return, defaults to 'site' and
114 * An array of available token replacement info or tokens, grouped by type.
116 public function getAvailableGlobalTokens($prepared = FALSE, array $types = []);
119 * Flattens the structure of form elements.
121 * If a form element has #flatten = TRUE, then all of it's children get moved
122 * to the same level as the element itself. So $form['to_be_flattened'][$key]
123 * becomes $form[$key], and $form['to_be_flattened'] gets unset.
126 * The form build array to alter.
129 * The form build array.
131 public static function preRenderFlattenData($form);
134 * Returns a string with any core tokens replaced.
136 * @param string $string
137 * The string to preform the token replacement on.
138 * @param array $options
139 * An array of options, as passed to \Drupal\Core\Utility\Token::replace().
142 * The tokenized string.
144 public function globalTokenReplace($string = '', array $options = []);
149 public function destroy();
152 * Validate that the plugin is correct and can be saved.
155 * An array of error strings to tell the user what is wrong with this
158 public function validate();
161 * Add anything to the query that we might need to.
163 public function query();
166 * Unpack options over our existing defaults, drilling down into arrays
167 * so that defaults don't get totally blown away.
169 public function unpackOptions(&$storage, $options, $definition = NULL, $all = TRUE, $check = TRUE);
172 * Provide a form to edit options for this plugin.
174 public function buildOptionsForm(&$form, FormStateInterface $form_state);
177 * Provide a full list of possible theme templates used by this style.
179 public function themeFunctions();