Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / views / src / Plugin / views / ViewsPluginInterface.php
1 <?php
2
3 namespace Drupal\views\Plugin\views;
4
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;
11
12 /**
13  * Provides an interface for all views plugins.
14  */
15 interface ViewsPluginInterface extends PluginInspectionInterface, DerivativeInspectionInterface {
16
17   /**
18    * Returns the plugin provider.
19    *
20    * @return string
21    */
22   public function getProvider();
23
24   /**
25    * Return the human readable name of the display.
26    *
27    * This appears on the ui beside each plugin and beside the settings link.
28    */
29   public function pluginTitle();
30
31   /**
32    * Returns the usesOptions property.
33    */
34   public function usesOptions();
35
36   /**
37    * Filter out stored options depending on the defined options.
38    *
39    * @param array $storage
40    *   The stored options.
41    */
42   public function filterByDefinedOptions(array &$storage);
43
44   /**
45    * Validate the options form.
46    */
47   public function validateOptionsForm(&$form, FormStateInterface $form_state);
48
49   /**
50    * Returns the summary of the settings in the display.
51    */
52   public function summaryTitle();
53
54   /**
55    * Moves form elements into fieldsets for presentation purposes.
56    *
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().
62    *
63    * @param array $form
64    *   The form build array to alter.
65    *
66    * @return array
67    *   The form build array.
68    */
69   public static function preRenderAddFieldsetMarkup(array $form);
70
71   /**
72    * {@inheritdoc}
73    */
74   public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition);
75
76   /**
77    * Initialize the plugin.
78    *
79    * @param \Drupal\views\ViewExecutable $view
80    *   The view object.
81    * @param \Drupal\views\Plugin\views\display\DisplayPluginBase $display
82    *   The display handler.
83    * @param array $options
84    *   The options configured for this plugin.
85    */
86   public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL);
87
88   /**
89    * Handle any special handling on the validate form.
90    */
91   public function submitOptionsForm(&$form, FormStateInterface $form_state);
92
93   /**
94    * Adds elements for available core tokens to a form.
95    *
96    * @param array $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.
100    */
101   public function globalTokenForm(&$form, FormStateInterface $form_state);
102
103   /**
104    * Returns an array of available token replacements.
105    *
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
111    *   'view'.
112    *
113    * @return array
114    *   An array of available token replacement info or tokens, grouped by type.
115    */
116   public function getAvailableGlobalTokens($prepared = FALSE, array $types = []);
117
118   /**
119    * Flattens the structure of form elements.
120    *
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.
124    *
125    * @param array $form
126    *   The form build array to alter.
127    *
128    * @return array
129    *   The form build array.
130    */
131   public static function preRenderFlattenData($form);
132
133   /**
134    * Returns a string with any core tokens replaced.
135    *
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().
140    *
141    * @return string
142    *   The tokenized string.
143    */
144   public function globalTokenReplace($string = '', array $options = []);
145
146   /**
147    * Clears a plugin.
148    */
149   public function destroy();
150
151   /**
152    * Validate that the plugin is correct and can be saved.
153    *
154    * @return
155    *   An array of error strings to tell the user what is wrong with this
156    *   plugin.
157    */
158   public function validate();
159
160   /**
161    * Add anything to the query that we might need to.
162    */
163   public function query();
164
165   /**
166    * Unpack options over our existing defaults, drilling down into arrays
167    * so that defaults don't get totally blown away.
168    */
169   public function unpackOptions(&$storage, $options, $definition = NULL, $all = TRUE, $check = TRUE);
170
171   /**
172    * Provide a form to edit options for this plugin.
173    */
174   public function buildOptionsForm(&$form, FormStateInterface $form_state);
175
176   /**
177    * Provide a full list of possible theme templates used by this style.
178    */
179   public function themeFunctions();
180
181 }