Newer
Older
Alex Pott
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* @file
* Contains \Drupal\views\Plugin\views\ViewsHandlerInterface.
*/
namespace Drupal\views\Plugin\views;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
/**
* Provides an interface for all views handlers.
*/
interface ViewsHandlerInterface extends ViewsPluginInterface {
/**
* Run before the view is built.
*
* This gives all the handlers some time to set up before any handler has
* been fully run.
*/
public function preQuery();
/**
* Determines the entity type used by this handler.
*
* If this handler uses a relationship, the base class of the relationship is
* taken into account.
*
* @return string
* The machine name of the entity type.
*/
public function getEntityType();
/**
* Determines if the handler is considered 'broken', meaning it's a
* a placeholder used when a handler can't be found.
*/
public function broken();
/**
* Ensure the main table for this handler is in the query. This is used
* a lot.
*/
public function ensureMyTable();
/**
* Check whether given user has access to this handler.
Alex Pott
committed
*
* @param AccountInterface $account
* The user account to check.
Alex Pott
committed
*
* @return bool
* TRUE if the user has access to the handler, FALSE otherwise.
Alex Pott
committed
*/
public function access(AccountInterface $account);
/**
* Get the join object that should be used for this handler.
*
* This method isn't used a great deal, but it's very handy for easily
* getting the join if it is necessary to make some changes to it, such
* as adding an 'extra'.
*/
public function getJoin();
/**
* Sanitize the value for output.
*
* @param $value
* The value being rendered.
* @param $type
* The type of sanitization needed. If not provided,
* \Drupal\Component\Utility\Html::escape() is used.
Alex Pott
committed
*
Alex Bronstein
committed
* @return \Drupal\views\Render\ViewsRenderPipelineMarkup
Alex Pott
committed
* Returns the safe value.
*/
public function sanitizeValue($value, $type = NULL);
/**
* Fetches a handler to join one table to a primary table from the data cache.
*
* @param string $table
* The table to join from.
* @param string $base_table
* The table to join to.
*
* @return \Drupal\views\Plugin\views\join\JoinPluginBase
*/
public static function getTableJoin($table, $base_table);
/**
* Shortcut to get a handler's raw field value.
*
* This should be overridden for handlers with formulae or other
* non-standard fields. Because this takes an argument, fields
* overriding this can just call return parent::getField($formula)
*/
public function getField($field = NULL);
/**
* Run after the view is executed, before the result is cached.
*
* This gives all the handlers some time to modify values. This is primarily
* used so that handlers that pull up secondary data can put it in the
Alex Pott
committed
* $values so that the raw data can be used externally.
Alex Pott
committed
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
*/
public function postExecute(&$values);
/**
* Shortcut to display the exposed options form.
*/
public function showExposeForm(&$form, FormStateInterface $form_state);
/**
* Called just prior to query(), this lets a handler set up any relationship
* it needs.
*/
public function setRelationship();
/**
* Return a string representing this handler's name in the UI.
*/
public function adminLabel($short = FALSE);
/**
* Breaks x,y,z and x+y+z into an array.
*
* @param string $str
* The string to split.
* @param bool $force_int
* Enforce a numeric check.
*
* @return \stdClass
* A stdClass object containing value and operator properties.
*/
public static function breakString($str, $force_int = FALSE);
/**
* Provide text for the administrative summary.
*/
public function adminSummary();
}