3 namespace Drupal\views\Plugin\views;
5 use Drupal\Core\Form\FormStateInterface;
6 use Drupal\Core\Session\AccountInterface;
9 * Provides an interface for all views handlers.
11 interface ViewsHandlerInterface extends ViewsPluginInterface {
14 * Run before the view is built.
16 * This gives all the handlers some time to set up before any handler has
19 public function preQuery();
22 * Determines the entity type used by this handler.
24 * If this handler uses a relationship, the base class of the relationship is
28 * The machine name of the entity type.
30 public function getEntityType();
33 * Determines if the handler is considered 'broken', meaning it's a
34 * a placeholder used when a handler can't be found.
36 public function broken();
39 * Ensure the main table for this handler is in the query. This is used
42 public function ensureMyTable();
45 * Check whether given user has access to this handler.
47 * @param AccountInterface $account
48 * The user account to check.
51 * TRUE if the user has access to the handler, FALSE otherwise.
53 public function access(AccountInterface $account);
56 * Get the join object that should be used for this handler.
58 * This method isn't used a great deal, but it's very handy for easily
59 * getting the join if it is necessary to make some changes to it, such
60 * as adding an 'extra'.
62 public function getJoin();
65 * Sanitize the value for output.
68 * The value being rendered.
70 * The type of sanitization needed. If not provided,
71 * \Drupal\Component\Utility\Html::escape() is used.
73 * @return \Drupal\views\Render\ViewsRenderPipelineMarkup
74 * Returns the safe value.
76 public function sanitizeValue($value, $type = NULL);
79 * Fetches a handler to join one table to a primary table from the data cache.
81 * @param string $table
82 * The table to join from.
83 * @param string $base_table
84 * The table to join to.
86 * @return \Drupal\views\Plugin\views\join\JoinPluginBase
88 public static function getTableJoin($table, $base_table);
91 * Shortcut to get a handler's raw field value.
93 * This should be overridden for handlers with formulae or other
94 * non-standard fields. Because this takes an argument, fields
95 * overriding this can just call return parent::getField($formula)
97 public function getField($field = NULL);
100 * Run after the view is executed, before the result is cached.
102 * This gives all the handlers some time to modify values. This is primarily
103 * used so that handlers that pull up secondary data can put it in the
104 * $values so that the raw data can be used externally.
106 public function postExecute(&$values);
109 * Shortcut to display the exposed options form.
111 public function showExposeForm(&$form, FormStateInterface $form_state);
114 * Called just prior to query(), this lets a handler set up any relationship
117 public function setRelationship();
120 * Return a string representing this handler's name in the UI.
122 public function adminLabel($short = FALSE);
125 * Breaks x,y,z and x+y+z into an array.
128 * The string to split.
129 * @param bool $force_int
130 * Enforce a numeric check.
133 * A stdClass object containing value and operator properties.
135 public static function breakString($str, $force_int = FALSE);
138 * Provide text for the administrative summary.
140 public function adminSummary();