1. 8.2.x core/modules/views/views.api.php
  2. 8.0.x core/modules/views/views.api.php
  3. 8.1.x core/modules/views/views.api.php
  4. 8.3.x core/modules/views/views.api.php

Describes hooks and plugins provided by the Views module.

File

core/modules/views/views.api.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Describes hooks and plugins provided by the Views module.
  5. */
  6. use Drupal\Core\Language\LanguageInterface;
  7. use Drupal\views\Plugin\views\cache\CachePluginBase;
  8. use Drupal\views\Plugin\views\PluginBase;
  9. use Drupal\views\ViewExecutable;
  10. /**
  11. * @defgroup views_overview Views overview
  12. * @{
  13. * Overview of the Views module API
  14. *
  15. * The Views module is a generalized query and display engine, which can be used
  16. * to make views (formatted lists, grids, feeds, and other output) of items
  17. * (often entities, but can be other types of data). Developers can interact
  18. * with Views in several ways:
  19. * - Provide plugins: Views plugins govern nearly every aspect of views,
  20. * including querying (sorting, filtering, etc.) and display (at several
  21. * levels of granularity, ranging from the entire view to the details of a
  22. * field). See the @link views_plugins Views plugins topic @endlink for
  23. * more information.
  24. * - Provide data: Data types can be provided to Views by implementing
  25. * hook_views_data(), and data types provided by other modules can be altered
  26. * by implementing hook_views_data_alter(). To provide views data for an
  27. * entity, create a class implementing
  28. * \Drupal\views\EntityViewsDataInterface and reference this in the
  29. * "views_data" annotation in the entity class. You can autogenerate big parts
  30. * of the integration if you extend the \Drupal\views\EntityViewsData base
  31. * class. See the @link entity_api Entity API topic @endlink for more
  32. * information about entities.
  33. * - Implement hooks: A few operations in Views can be influenced by hooks.
  34. * See the @link views_hooks Views hooks topic @endlink for a list.
  35. * - Theming: See the @link views_templates Views templates topic @endlink
  36. * for more information.
  37. *
  38. * @see \Drupal\views\ViewExecutable
  39. * @see \Drupal\views\Views
  40. * @}
  41. */
  42. /**
  43. * @defgroup views_plugins Views plugins
  44. * @{
  45. * Overview of views plugins
  46. *
  47. * Views plugins are objects that are used to build and render the view.
  48. * See individual views plugin topics for more information about the
  49. * specifics of each plugin type, and the
  50. * @link plugin_api Plugin API topic @endlink for more information about
  51. * plugins in general.
  52. *
  53. * Some Views plugins are known as handlers. Handler plugins help build the
  54. * view query object: filtering, contextual filtering, sorting, relationships,
  55. * etc.
  56. *
  57. * @todo Document specific options on the appropriate plugin base classes.
  58. * @todo Add examples.
  59. *
  60. * @ingroup views_overview
  61. * @see \Drupal\views\Plugin\views\PluginBase
  62. * @see \Drupal\views\Plugin\views\HandlerBase
  63. * @see plugin_api
  64. * @see annotation
  65. * @}
  66. */
  67. /**
  68. * @defgroup views_hooks Views hooks
  69. * @{
  70. * Hooks that allow other modules to implement the Views API.
  71. * @ingroup views_overview
  72. * @}
  73. */
  74. /**
  75. * @addtogroup hooks
  76. * @{
  77. */
  78. /**
  79. * Analyze a view to provide warnings about its configuration.
  80. *
  81. * @param \Drupal\views\ViewExecutable $view
  82. * The view being executed.
  83. *
  84. * @return array
  85. * Array of warning messages built by Analyzer::formatMessage to be displayed
  86. * to the user following analysis of the view.
  87. */
  88. function hook_views_analyze(Drupal\views\ViewExecutable $view) {
  89. $messages = array();
  90. if ($view->display_handler->options['pager']['type'] == 'none') {
  91. $messages[] = Drupal\views\Analyzer::formatMessage(t('This view has no pager. This could cause performance issues when the view contains many items.'), 'warning');
  92. }
  93. return $messages;
  94. }
  95. /**
  96. * Describe data tables and fields (or the equivalent) to Views.
  97. *
  98. * The table and fields are processed in Views using various plugins. See
  99. * the @link views_plugins Views plugins topic @endlink for more information.
  100. *
  101. * To provide views data for an entity, instead of implementing this hook,
  102. * create a class implementing \Drupal\views\EntityViewsDataInterface and
  103. * reference this in the "views" annotation in the entity class. The return
  104. * value of the getViewsData() method on the interface is the same as this hook,
  105. * and base class in \Drupal\views\EntityViewsData will take care of adding the
  106. * basic Views tables and fields for your entity. See the
  107. * @link entity_api Entity API topic @endlink for more information about
  108. * entities.
  109. *
  110. * The data described with this hook is fetched and retrieved by
  111. * \Drupal\views\Views::viewsData()->get().
  112. *
  113. * @return array
  114. * An associative array describing the structure of database tables and fields
  115. * (and their equivalents) provided for use in Views. At the outermost level,
  116. * the keys are the names used internally by Views for the tables (usually the
  117. * actual table name). Each table's array describes the table itself, how to
  118. * join to other tables, and the fields that are part of the table. The sample
  119. * function body provides documentation of the details.
  120. *
  121. * @see hook_views_data_alter()
  122. */
  123. function hook_views_data() {
  124. // This example describes how to write hook_views_data() for a table defined
  125. // like this:
  126. // CREATE TABLE example_table (
  127. // nid INT(11) NOT NULL COMMENT 'Primary key: {node}.nid.',
  128. // plain_text_field VARCHAR(32) COMMENT 'Just a plain text field.',
  129. // numeric_field INT(11) COMMENT 'Just a numeric field.',
  130. // boolean_field INT(1) COMMENT 'Just an on/off field.',
  131. // timestamp_field INT(8) COMMENT 'Just a timestamp field.',
  132. // langcode VARCHAR(12) COMMENT 'Language code field.',
  133. // PRIMARY KEY(nid)
  134. // );
  135. // Define the return array.
  136. $data = array();
  137. // The outermost keys of $data are Views table names, which should usually
  138. // be the same as the hook_schema() table names.
  139. $data['example_table'] = array();
  140. // The value corresponding to key 'table' gives properties of the table
  141. // itself.
  142. $data['example_table']['table'] = array();
  143. // Within 'table', the value of 'group' (translated string) is used as a
  144. // prefix in Views UI for this table's fields, filters, etc. When adding
  145. // a field, filter, etc. you can also filter by the group.
  146. $data['example_table']['table']['group'] = t('Example table');
  147. // Within 'table', the value of 'provider' is the module that provides schema
  148. // or the entity type that causes the table to exist. Setting this ensures
  149. // that views have the correct dependencies. This is automatically set to the
  150. // module that implements hook_views_data().
  151. $data['example_table']['table']['provider'] = 'example_module';
  152. // Some tables are "base" tables, meaning that they can be the base tables
  153. // for views. Non-base tables can only be brought in via relationships in
  154. // views based on other tables. To define a table to be a base table, add
  155. // key 'base' to the 'table' array:
  156. $data['example_table']['table']['base'] = array(
  157. // Identifier (primary) field in this table for Views.
  158. 'field' => 'nid',
  159. // Label in the UI.
  160. 'title' => t('Example table'),
  161. // Longer description in the UI. Required.
  162. 'help' => t('Example table contains example content and can be related to nodes.'),
  163. 'weight' => -10,
  164. );
  165. // Some tables have an implicit, automatic relationship to other tables,
  166. // meaning that when the other table is available in a view (either as the
  167. // base table or through a relationship), this table's fields, filters, etc.
  168. // are automatically made available without having to add an additional
  169. // relationship. To define an implicit relationship that will make your
  170. // table automatically available when another table is present, add a 'join'
  171. // section to your 'table' section. Note that it is usually only a good idea
  172. // to do this for one-to-one joins, because otherwise your automatic join
  173. // will add more rows to the view. It is also not a good idea to do this if
  174. // most views won't need your table -- if that is the case, define a
  175. // relationship instead (see below).
  176. //
  177. // If you've decided an automatic join is a good idea, here's how to do it;
  178. // the resulting SQL query will look something like this:
  179. // ... FROM example_table et ... JOIN node_field_data nfd
  180. // ON et.nid = nfd.nid AND ('extra' clauses will be here) ...
  181. // although the table aliases will be different.
  182. $data['example_table']['table']['join'] = array(
  183. // Within the 'join' section, list one or more tables to automatically
  184. // join to. In this example, every time 'node_field_data' is available in
  185. // a view, 'example_table' will be too. The array keys here are the array
  186. // keys for the other tables, given in their hook_views_data()
  187. // implementations. If the table listed here is from another module's
  188. // hook_views_data() implementation, make sure your module depends on that
  189. // other module.
  190. 'node_field_data' => array(
  191. // Primary key field in node_field_data to use in the join.
  192. 'left_field' => 'nid',
  193. // Foreign key field in example_table to use in the join.
  194. 'field' => 'nid',
  195. // 'extra' is an array of additional conditions on the join.
  196. 'extra' => array(
  197. 0 => array(
  198. // Adds AND node_field_data.published = TRUE to the join.
  199. 'field' => 'published',
  200. 'value' => TRUE,
  201. ),
  202. 1 => array(
  203. // Adds AND example_table.numeric_field = 1 to the join.
  204. 'left_field' => 'numeric_field',
  205. 'value' => 1,
  206. // If true, the value will not be surrounded in quotes.
  207. 'numeric' => TRUE,
  208. ),
  209. 2 => array(
  210. // Adds AND example_table.boolean_field <>
  211. // node_field_data.published to the join.
  212. 'field' => 'published',
  213. 'left_field' => 'boolean_field',
  214. // The operator used, Defaults to "=".
  215. 'operator' => '!=',
  216. ),
  217. ),
  218. ),
  219. );
  220. // You can also do a more complex join, where in order to get to a certain
  221. // base table defined in a hook_views_data() implementation, you will join
  222. // to a different table that Views knows how to auto-join to the base table.
  223. // For instance, if another module that your module depends on had
  224. // defined a table 'foo' with an automatic join to 'node_field_table' (as
  225. // shown above), you could join to 'node_field_table' via the 'foo' table.
  226. // Here's how to do this, and the resulting SQL query would look something
  227. // like this:
  228. // ... FROM example_table et ... JOIN foo foo
  229. // ON et.nid = foo.nid AND ('extra' clauses will be here) ...
  230. // JOIN node_field_data nfd ON (definition of the join from the foo
  231. // module goes here) ...
  232. // although the table aliases will be different.
  233. $data['example_table']['table']['join']['node_field_data'] = array(
  234. // 'node_field_data' above is the base we're joining to in Views.
  235. // 'left_table' is the table we're actually joining to, in order to get to
  236. // 'node_field_data'. It has to be something that Views knows how to join
  237. // to 'node_field_data'.
  238. 'left_table' => 'foo',
  239. 'left_field' => 'nid',
  240. 'field' => 'nid',
  241. // 'extra' is an array of additional conditions on the join.
  242. 'extra' => array(
  243. // This syntax matches additional fields in the two tables:
  244. // ... AND foo.langcode = example_table.langcode ...
  245. array('left_field' => 'langcode', 'field' => 'langcode'),
  246. // This syntax adds a condition on our table. 'operator' defaults to
  247. // '=' for non-array values, or 'IN' for array values.
  248. // ... AND example_table.numeric_field > 0 ...
  249. array('field' => 'numeric_field', 'value' => 0, 'numeric' => TRUE, 'operator' => '>'),
  250. ),
  251. );
  252. // Other array elements at the top level of your table's array describe
  253. // individual database table fields made available to Views. The array keys
  254. // are the names (unique within the table) used by Views for the fields,
  255. // usually equal to the database field names.
  256. //
  257. // Each field entry must have the following elements:
  258. // - title: Translated label for the field in the UI.
  259. // - help: Description of the field in the UI.
  260. //
  261. // Each field entry may also have one or more of the following elements,
  262. // describing "handlers" (plugins) for the field:
  263. // - relationship: Specifies a handler that allows this field to be used
  264. // to define a relationship to another table in Views.
  265. // - field: Specifies a handler to make it available to Views as a field.
  266. // - filter: Specifies a handler to make it available to Views as a filter.
  267. // - sort: Specifies a handler to make it available to Views as a sort.
  268. // - argument: Specifies a handler to make it available to Views as an
  269. // argument, or contextual filter as it is known in the UI.
  270. // - area: Specifies a handler to make it available to Views to add content
  271. // to the header, footer, or as no result behavior.
  272. //
  273. // Note that when specifying handlers, you must give the handler plugin ID
  274. // and you may also specify overrides for various settings that make up the
  275. // plugin definition. See examples below; the Boolean example demonstrates
  276. // setting overrides.
  277. // Node ID field, exposed as relationship only, since it is a foreign key
  278. // in this table.
  279. $data['example_table']['nid'] = array(
  280. 'title' => t('Example content'),
  281. 'help' => t('Relate example content to the node content'),
  282. // Define a relationship to the node_field_data table, so views whose
  283. // base table is example_table can add a relationship to nodes. To make a
  284. // relationship in the other direction, you can:
  285. // - Use hook_views_data_alter() -- see the function body example on that
  286. // hook for details.
  287. // - Use the implicit join method described above.
  288. 'relationship' => array(
  289. // Views name of the table to join to for the relationship.
  290. 'base' => 'node_field_data',
  291. // Database field name in the other table to join on.
  292. 'base field' => 'nid',
  293. // ID of relationship handler plugin to use.
  294. 'id' => 'standard',
  295. // Default label for relationship in the UI.
  296. 'label' => t('Example node'),
  297. ),
  298. );
  299. // Plain text field, exposed as a field, sort, filter, and argument.
  300. $data['example_table']['plain_text_field'] = array(
  301. 'title' => t('Plain text field'),
  302. 'help' => t('Just a plain text field.'),
  303. 'field' => array(
  304. // ID of field handler plugin to use.
  305. 'id' => 'standard',
  306. ),
  307. 'sort' => array(
  308. // ID of sort handler plugin to use.
  309. 'id' => 'standard',
  310. ),
  311. 'filter' => array(
  312. // ID of filter handler plugin to use.
  313. 'id' => 'string',
  314. ),
  315. 'argument' => array(
  316. // ID of argument handler plugin to use.
  317. 'id' => 'string',
  318. ),
  319. );
  320. // Numeric field, exposed as a field, sort, filter, and argument.
  321. $data['example_table']['numeric_field'] = array(
  322. 'title' => t('Numeric field'),
  323. 'help' => t('Just a numeric field.'),
  324. 'field' => array(
  325. // ID of field handler plugin to use.
  326. 'id' => 'numeric',
  327. ),
  328. 'sort' => array(
  329. // ID of sort handler plugin to use.
  330. 'id' => 'standard',
  331. ),
  332. 'filter' => array(
  333. // ID of filter handler plugin to use.
  334. 'id' => 'numeric',
  335. ),
  336. 'argument' => array(
  337. // ID of argument handler plugin to use.
  338. 'id' => 'numeric',
  339. ),
  340. );
  341. // Boolean field, exposed as a field, sort, and filter. The filter section
  342. // illustrates overriding various settings.
  343. $data['example_table']['boolean_field'] = array(
  344. 'title' => t('Boolean field'),
  345. 'help' => t('Just an on/off field.'),
  346. 'field' => array(
  347. // ID of field handler plugin to use.
  348. 'id' => 'boolean',
  349. ),
  350. 'sort' => array(
  351. // ID of sort handler plugin to use.
  352. 'id' => 'standard',
  353. ),
  354. 'filter' => array(
  355. // ID of filter handler plugin to use.
  356. 'id' => 'boolean',
  357. // Override the generic field title, so that the filter uses a different
  358. // label in the UI.
  359. 'label' => t('Published'),
  360. // Override the default BooleanOperator filter handler's 'type' setting,
  361. // to display this as a "Yes/No" filter instead of a "True/False" filter.
  362. 'type' => 'yes-no',
  363. // Override the default Boolean filter handler's 'use_equal' setting, to
  364. // make the query use 'boolean_field = 1' instead of 'boolean_field <> 0'.
  365. 'use_equal' => TRUE,
  366. ),
  367. );
  368. // Integer timestamp field, exposed as a field, sort, and filter.
  369. $data['example_table']['timestamp_field'] = array(
  370. 'title' => t('Timestamp field'),
  371. 'help' => t('Just a timestamp field.'),
  372. 'field' => array(
  373. // ID of field handler plugin to use.
  374. 'id' => 'date',
  375. ),
  376. 'sort' => array(
  377. // ID of sort handler plugin to use.
  378. 'id' => 'date',
  379. ),
  380. 'filter' => array(
  381. // ID of filter handler plugin to use.
  382. 'id' => 'date',
  383. ),
  384. );
  385. // Area example. Areas are not generally associated with actual data
  386. // tables and fields. This example is from views_views_data(), which defines
  387. // the "Global" table (not really a table, but a group of Fields, Filters,
  388. // etc. that are grouped into section "Global" in the UI). Here's the
  389. // definition of the generic "Text area":
  390. $data['views']['area'] = array(
  391. 'title' => t('Text area'),
  392. 'help' => t('Provide markup text for the area.'),
  393. 'area' => array(
  394. // ID of the area handler plugin to use.
  395. 'id' => 'text',
  396. ),
  397. );
  398. return $data;
  399. }
  400. /**
  401. * Alter the table and field information from hook_views_data().
  402. *
  403. * @param array $data
  404. * An array of all information about Views tables and fields, collected from
  405. * hook_views_data(), passed by reference.
  406. *
  407. * @see hook_views_data()
  408. */
  409. function hook_views_data_alter(array &$data) {
  410. // Alter the title of the node_field_data:nid field in the Views UI.
  411. $data['node_field_data']['nid']['title'] = t('Node-Nid');
  412. // Add an additional field to the users_field_data table.
  413. $data['users_field_data']['example_field'] = array(
  414. 'title' => t('Example field'),
  415. 'help' => t('Some example content that references a user'),
  416. 'field' => array(
  417. // ID of the field handler to use.
  418. 'id' => 'example_field',
  419. ),
  420. );
  421. // Change the handler of the node title field, presumably to a handler plugin
  422. // you define in your module. Give the ID of this plugin.
  423. $data['node_field_data']['title']['field']['id'] = 'node_title';
  424. // Add a relationship that will allow a view whose base table is 'foo' (from
  425. // another module) to have a relationship to 'example_table' (from my module),
  426. // via joining foo.fid to example_table.eid.
  427. //
  428. // This relationship has to be added to the 'foo' Views data, which my module
  429. // does not control, so it must be done in hook_views_data_alter(), not
  430. // hook_views_data().
  431. //
  432. // In Views data definitions, each field can have only one relationship. So
  433. // rather than adding this relationship directly to the $data['foo']['fid']
  434. // field entry, which could overwrite an existing relationship, we define
  435. // a dummy field key to handle the relationship.
  436. $data['foo']['unique_dummy_name'] = array(
  437. 'title' => t('Title seen while adding relationship'),
  438. 'help' => t('More information about the relationship'),
  439. 'relationship' => array(
  440. // Views name of the table being joined to from foo.
  441. 'base' => 'example_table',
  442. // Database field name in example_table for the join.
  443. 'base field' => 'eid',
  444. // Real database field name in foo for the join, to override
  445. // 'unique_dummy_name'.
  446. 'field' => 'fid',
  447. // ID of relationship handler plugin to use.
  448. 'id' => 'standard',
  449. 'label' => t('Default label for relationship'),
  450. ),
  451. );
  452. // Note that the $data array is not returned – it is modified by reference.
  453. }
  454. /**
  455. * Override the default Views data for a Field API field.
  456. *
  457. * The field module's implementation of hook_views_data() invokes this for each
  458. * field storage, in the module that defines the field type. It is not invoked
  459. * in other modules.
  460. *
  461. * If no hook implementation exists, hook_views_data() falls back to
  462. * views_field_default_views_data().
  463. *
  464. * @param \Drupal\field\FieldStorageConfigInterface $field_storage
  465. * The field storage config entity.
  466. *
  467. * @return array
  468. * An array of views data, in the same format as the return value of
  469. * hook_views_data().
  470. *
  471. * @see views_views_data()
  472. * @see hook_field_views_data_alter()
  473. * @see hook_field_views_data_views_data_alter()
  474. */
  475. function hook_field_views_data(\Drupal\field\FieldStorageConfigInterface $field_storage) {
  476. $data = views_field_default_views_data($field_storage);
  477. foreach ($data as $table_name => $table_data) {
  478. // Add the relationship only on the target_id field.
  479. $data[$table_name][$field_storage->getName() . '_target_id']['relationship'] = array(
  480. 'id' => 'standard',
  481. 'base' => 'file_managed',
  482. 'base field' => 'target_id',
  483. 'label' => t('image from @field_name', array('@field_name' => $field_storage->getName())),
  484. );
  485. }
  486. return $data;
  487. }
  488. /**
  489. * Alter the Views data for a single Field API field.
  490. *
  491. * This is called on all modules even if there is no hook_field_views_data()
  492. * implementation for the field, and therefore may be used to alter the
  493. * default data that views_field_default_views_data() supplies for the
  494. * field storage.
  495. *
  496. * @param array $data
  497. * The views data for the field storage. This has the same format as the
  498. * return value of hook_views_data().
  499. * @param \Drupal\field\FieldStorageConfigInterface $field_storage
  500. * The field storage config entity.
  501. *
  502. * @see views_views_data()
  503. * @see hook_field_views_data()
  504. * @see hook_field_views_data_views_data_alter()
  505. */
  506. function hook_field_views_data_alter(array &$data, \Drupal\field\FieldStorageConfigInterface $field_storage) {
  507. $entity_type_id = $field_storage->getTargetEntityTypeId();
  508. $field_name = $field_storage->getName();
  509. $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id);
  510. $pseudo_field_name = 'reverse_' . $field_name . '_' . $entity_type_id;
  511. $table_mapping = \Drupal::entityManager()->getStorage($entity_type_id)->getTableMapping();
  512. list($label) = views_entity_field_label($entity_type_id, $field_name);
  513. $data['file_managed'][$pseudo_field_name]['relationship'] = array(
  514. 'title' => t('@entity using @field', array('@entity' => $entity_type->getLabel(), '@field' => $label)),
  515. 'help' => t('Relate each @entity with a @field set to the image.', array('@entity' => $entity_type->getLabel(), '@field' => $label)),
  516. 'id' => 'entity_reverse',
  517. 'field_name' => $field_name,
  518. 'entity_type' => $entity_type_id,
  519. 'field table' => $table_mapping->getDedicatedDataTableName($field_storage),
  520. 'field field' => $field_name . '_target_id',
  521. 'base' => $entity_type->getBaseTable(),
  522. 'base field' => $entity_type->getKey('id'),
  523. 'label' => $field_name,
  524. 'join_extra' => array(
  525. 0 => array(
  526. 'field' => 'deleted',
  527. 'value' => 0,
  528. 'numeric' => TRUE,
  529. ),
  530. ),
  531. );
  532. }
  533. /**
  534. * Alter the Views data on a per field basis.
  535. *
  536. * The field module's implementation of hook_views_data_alter() invokes this for
  537. * each field storage, in the module that defines the field type. It is not
  538. * invoked in other modules.
  539. *
  540. * Unlike hook_field_views_data_alter(), this operates on the whole of the views
  541. * data. This allows a field type to add data that concerns its fields in
  542. * other tables, which would not yet be defined at the point when
  543. * hook_field_views_data() and hook_field_views_data_alter() are invoked. For
  544. * example, entityreference adds reverse relationships on the tables for the
  545. * entities which are referenced by entityreference fields.
  546. *
  547. * (Note: this is weirdly named so as not to conflict with
  548. * hook_field_views_data_alter().)
  549. *
  550. * @param array $data
  551. * The views data.
  552. * @param \Drupal\field\FieldStorageConfigInterface $field
  553. * The field storage config entity.
  554. *
  555. * @see hook_field_views_data()
  556. * @see hook_field_views_data_alter()
  557. * @see views_views_data_alter()
  558. */
  559. function hook_field_views_data_views_data_alter(array &$data, \Drupal\field\FieldStorageConfigInterface $field) {
  560. $field_name = $field->getName();
  561. $data_key = 'field_data_' . $field_name;
  562. $entity_type_id = $field->entity_type;
  563. $entity_type = \Drupal::entityManager()->getDefinition($entity_type_id);
  564. $pseudo_field_name = 'reverse_' . $field_name . '_' . $entity_type_id;
  565. list($label) = views_entity_field_label($entity_type_id, $field_name);
  566. $table_mapping = \Drupal::entityManager()->getStorage($entity_type_id)->getTableMapping();
  567. // Views data for this field is in $data[$data_key].
  568. $data[$data_key][$pseudo_field_name]['relationship'] = array(
  569. 'title' => t('@entity using @field', array('@entity' => $entity_type->getLabel(), '@field' => $label)),
  570. 'help' => t('Relate each @entity with a @field set to the term.', array('@entity' => $entity_type->getLabel(), '@field' => $label)),
  571. 'id' => 'entity_reverse',
  572. 'field_name' => $field_name,
  573. 'entity_type' => $entity_type_id,
  574. 'field table' => $table_mapping->getDedicatedDataTableName($field),
  575. 'field field' => $field_name . '_target_id',
  576. 'base' => $entity_type->getBaseTable(),
  577. 'base field' => $entity_type->getKey('id'),
  578. 'label' => $field_name,
  579. 'join_extra' => array(
  580. 0 => array(
  581. 'field' => 'deleted',
  582. 'value' => 0,
  583. 'numeric' => TRUE,
  584. ),
  585. ),
  586. );
  587. }
  588. /**
  589. * Replace special strings in the query before it is executed.
  590. *
  591. * The idea is that certain dynamic values can be placed in a query when it is
  592. * built, and substituted at run-time, allowing the query to be cached and
  593. * still work correctly when executed.
  594. *
  595. * @param \Drupal\views\ViewExecutable $view
  596. * The View being executed.
  597. *
  598. * @return array
  599. * An associative array where each key is a string to be replaced, and the
  600. * corresponding value is its replacement. The strings to replace are often
  601. * surrounded with '***', as illustrated in the example implementation, to
  602. * avoid collisions with other values in the query.
  603. */
  604. function hook_views_query_substitutions(ViewExecutable $view) {
  605. // Example from views_views_query_substitutions().
  606. return array(
  607. '***CURRENT_VERSION***' => \Drupal::VERSION,
  608. '***CURRENT_TIME***' => REQUEST_TIME,
  609. '***LANGUAGE_language_content***' => \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId(),
  610. PluginBase::VIEWS_QUERY_LANGUAGE_SITE_DEFAULT => \Drupal::languageManager()->getDefaultLanguage()->getId(),
  611. );
  612. }
  613. /**
  614. * Replace special strings when processing a view with form elements.
  615. *
  616. * @return array
  617. * An associative array where each key is a string to be replaced, and the
  618. * corresponding value is its replacement. The value will be escaped unless it
  619. * is already marked safe.
  620. */
  621. function hook_views_form_substitutions() {
  622. return array(
  623. '<!--views-form-example-substitutions-->' => 'Example Substitution',
  624. );
  625. }
  626. /**
  627. * Alter a view at the very beginning of Views processing.
  628. *
  629. * Output can be added to the view by setting $view->attachment_before
  630. * and $view->attachment_after.
  631. *
  632. * @param \Drupal\views\ViewExecutable $view
  633. * The view object about to be processed.
  634. * @param string $display_id
  635. * The machine name of the active display.
  636. * @param array $args
  637. * An array of arguments passed into the view.
  638. *
  639. * @see \Drupal\views\ViewExecutable
  640. */
  641. function hook_views_pre_view(ViewExecutable $view, $display_id, array &$args) {
  642. // Modify contextual filters for my_special_view if user has 'my special permission'.
  643. $account = \Drupal::currentUser();
  644. if ($view->id() == 'my_special_view' && $account->hasPermission('my special permission') && $display_id == 'public_display') {
  645. $args[0] = 'custom value';
  646. }
  647. }
  648. /**
  649. * Act on the view before the query is built, but after displays are attached.
  650. *
  651. * Output can be added to the view by setting $view->attachment_before
  652. * and $view->attachment_after.
  653. *
  654. * @param \Drupal\views\ViewExecutable $view
  655. * The view object about to be processed.
  656. *
  657. * @see \Drupal\views\ViewExecutable
  658. */
  659. function hook_views_pre_build(ViewExecutable $view) {
  660. // Because of some inexplicable business logic, we should remove all
  661. // attachments from all views on Mondays.
  662. // (This alter could be done later in the execution process as well.)
  663. if (date('D') == 'Mon') {
  664. unset($view->attachment_before);
  665. unset($view->attachment_after);
  666. }
  667. }
  668. /**
  669. * Act on the view immediately after the query is built.
  670. *
  671. * Output can be added to the view by setting $view->attachment_before
  672. * and $view->attachment_after.
  673. *
  674. * @param \Drupal\views\ViewExecutable $view
  675. * The view object about to be processed.
  676. *
  677. * @see \Drupal\views\ViewExecutable
  678. */
  679. function hook_views_post_build(ViewExecutable $view) {
  680. // If the exposed field 'type' is set, hide the column containing the content
  681. // type. (Note that this is a solution for a particular view, and makes
  682. // assumptions about both exposed filter settings and the fields in the view.
  683. // Also note that this alter could be done at any point before the view being
  684. // rendered.)
  685. if ($view->id() == 'my_view' && isset($view->exposed_raw_input['type']) && $view->exposed_raw_input['type'] != 'All') {
  686. // 'Type' should be interpreted as content type.
  687. if (isset($view->field['type'])) {
  688. $view->field['type']->options['exclude'] = TRUE;
  689. }
  690. }
  691. }
  692. /**
  693. * Act on the view after the query is built and just before it is executed.
  694. *
  695. * Output can be added to the view by setting $view->attachment_before
  696. * and $view->attachment_after.
  697. *
  698. * @param \Drupal\views\ViewExecutable $view
  699. * The view object about to be processed.
  700. *
  701. * @see \Drupal\views\ViewExecutable
  702. */
  703. function hook_views_pre_execute(ViewExecutable $view) {
  704. // Whenever a view queries more than two tables, show a message that notifies
  705. // view administrators that the query might be heavy.
  706. // (This action could be performed later in the execution process, but not
  707. // earlier.)
  708. $account = \Drupal::currentUser();
  709. if (count($view->query->tables) > 2 && $account->hasPermission('administer views')) {
  710. drupal_set_message(t('The view %view may be heavy to execute.', array('%view' => $view->id())), 'warning');
  711. }
  712. }
  713. /**
  714. * Act on the view immediately after the query has been executed.
  715. *
  716. * At this point the query has been executed, but the preRender() phase has
  717. * not yet happened for handlers.
  718. *
  719. * Output can be added to the view by setting $view->attachment_before
  720. * and $view->attachment_after.
  721. *
  722. * @param \Drupal\views\ViewExecutable $view
  723. * The view object about to be processed.
  724. *
  725. * @see \Drupal\views\ViewExecutable
  726. */
  727. function hook_views_post_execute(ViewExecutable $view) {
  728. // If there are more than 100 results, show a message that encourages the user
  729. // to change the filter settings.
  730. // (This action could be performed later in the execution process, but not
  731. // earlier.)
  732. if ($view->total_rows > 100) {
  733. drupal_set_message(t('You have more than 100 hits. Use the filter settings to narrow down your list.'));
  734. }
  735. }
  736. /**
  737. * Act on the view immediately before rendering it.
  738. *
  739. * At this point the query has been executed, and the preRender() phase has
  740. * already happened for handlers, so all data should be available. This hook
  741. * can be used by themes.
  742. *
  743. * Output can be added to the view by setting $view->attachment_before
  744. * and $view->attachment_after.
  745. *
  746. * @param \Drupal\views\ViewExecutable $view
  747. * The view object about to be processed.
  748. *
  749. * @see \Drupal\views\ViewExecutable
  750. */
  751. function hook_views_pre_render(ViewExecutable $view) {
  752. // Scramble the order of the rows shown on this result page.
  753. // Note that this could be done earlier, but not later in the view execution
  754. // process.
  755. shuffle($view->result);
  756. }
  757. /**
  758. * Post-process any rendered data.
  759. *
  760. * This can be valuable to be able to cache a view and still have some level of
  761. * dynamic output. In an ideal world, the actual output will include HTML
  762. * comment-based tokens, and then the post process can replace those tokens.
  763. * This hook can be used by themes.
  764. *
  765. * Example usage. If it is known that the view is a node view and that the
  766. * primary field will be a nid, you can do something like this:
  767. * @code
  768. * <!--post-FIELD-NID-->
  769. * @endcode
  770. * And then in the post-render, create an array with the text that should
  771. * go there:
  772. * @code
  773. * strtr($output, array('<!--post-FIELD-1-->' => 'output for FIELD of nid 1');
  774. * @endcode
  775. * All of the cached result data will be available in $view->result, as well,
  776. * so all ids used in the query should be discoverable.
  777. *
  778. * @param \Drupal\views\ViewExecutable $view
  779. * The view object about to be processed.
  780. * @param string $output
  781. * A flat string with the rendered output of the view.
  782. * @param \Drupal\views\Plugin\views\cache\CachePluginBase $cache
  783. * The cache settings.
  784. *
  785. * @see \Drupal\views\ViewExecutable
  786. */
  787. function hook_views_post_render(ViewExecutable $view, &$output, CachePluginBase $cache) {
  788. // When using full pager, disable any time-based caching if there are fewer
  789. // than 10 results.
  790. if ($view->pager instanceof Drupal\views\Plugin\views\pager\Full && $cache instanceof Drupal\views\Plugin\views\cache\Time && count($view->result) < 10) {
  791. $cache->options['results_lifespan'] = 0;
  792. $cache->options['output_lifespan'] = 0;
  793. }
  794. }
  795. /**
  796. * Alter the query before it is executed.
  797. *
  798. * @param \Drupal\views\ViewExecutable $view
  799. * The view object about to be processed.
  800. * @param QueryPluginBase $query
  801. * The query plugin object for the query.
  802. *
  803. * @see hook_views_query_substitutions()
  804. * @see \Drupal\views\Plugin\views\query\Sql
  805. */
  806. function hook_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
  807. // (Example assuming a view with an exposed filter on node title.)
  808. // If the input for the title filter is a positive integer, filter against
  809. // node ID instead of node title.
  810. if ($view->id() == 'my_view' && is_numeric($view->exposed_raw_input['title']) && $view->exposed_raw_input['title'] > 0) {
  811. // Traverse through the 'where' part of the query.
  812. foreach ($query->where as &$condition_group) {
  813. foreach ($condition_group['conditions'] as &$condition) {
  814. // If this is the part of the query filtering on title, chang the
  815. // condition to filter on node ID.
  816. if ($condition['field'] == 'node.title') {
  817. $condition = array(
  818. 'field' => 'node.nid',
  819. 'value' => $view->exposed_raw_input['title'],
  820. 'operator' => '=',
  821. );
  822. }
  823. }
  824. }
  825. }
  826. }
  827. /**
  828. * Alter the view preview information.
  829. *
  830. * The view preview information is optionally displayed when a view is
  831. * previewed in the administrative UI. It includes query and performance
  832. * statistics.
  833. *
  834. * @param array $rows
  835. * An associative array with two keys:
  836. * - query: An array of rows suitable for '#type' => 'table', containing
  837. * information about the query and the display title and path.
  838. * - statistics: An array of rows suitable for '#type' => 'table',
  839. * containing performance statistics.
  840. * @param \Drupal\views\ViewExecutable $view
  841. * The view object.
  842. *
  843. * @see \Drupal\views_ui\ViewUI
  844. * @see table.html.twig
  845. */
  846. function hook_views_preview_info_alter(array &$rows, ViewExecutable $view) {
  847. // Adds information about the tables being queried by the view to the query
  848. // part of the info box.
  849. $rows['query'][] = array(
  850. t('<strong>Table queue</strong>'),
  851. count($view->query->table_queue) . ': (' . implode(', ', array_keys($view->query->table_queue)) . ')',
  852. );
  853. }
  854. /**
  855. * Alter the links displayed at the top of the view edit form.
  856. *
  857. * @param array $links
  858. * A renderable array of links which will be displayed at the top of the
  859. * view edit form. Each entry will be in a form suitable for
  860. * '#theme' => 'links'.
  861. * @param \Drupal\views\ViewExecutable $view
  862. * The view object being edited.
  863. * @param string $display_id
  864. * The ID of the display being edited, e.g. 'default' or 'page_1'.
  865. *
  866. * @see \Drupal\views_ui\ViewUI::renderDisplayTop()
  867. */
  868. function hook_views_ui_display_top_links_alter(array &$links, ViewExecutable $view, $display_id) {
  869. // Put the export link first in the list.
  870. if (isset($links['export'])) {
  871. $links = array('export' => $links['export']) + $links;
  872. }
  873. }
  874. // @todo Describe how to alter a view ajax response with event listeners.
  875. /**
  876. * Allow modules to respond to the invalidation of the Views cache.
  877. *
  878. * This hook will fire whenever a view is enabled, disabled, created,
  879. * updated, or deleted.
  880. *
  881. * @see views_invalidate_cache()
  882. */
  883. function hook_views_invalidate_cache() {
  884. \Drupal\Core\Cache\Cache::invalidateTags(array('views'));
  885. }
  886. /**
  887. * Modify the list of available views access plugins.
  888. *
  889. * This hook may be used to modify plugin properties after they have been
  890. * specified by other modules.
  891. *
  892. * @param array $plugins
  893. * An array of all the existing plugin definitions, passed by reference.
  894. *
  895. * @see \Drupal\views\Plugin\ViewsPluginManager
  896. */
  897. function hook_views_plugins_access_alter(array &$plugins) {
  898. // Remove the available plugin because the users should not have access to it.
  899. unset($plugins['role']);
  900. }
  901. /**
  902. * Modify the list of available views default argument plugins.
  903. *
  904. * This hook may be used to modify plugin properties after they have been
  905. * specified by other modules.
  906. *
  907. * @param array $plugins
  908. * An array of all the existing plugin definitions, passed by reference.
  909. *
  910. * @see \Drupal\views\Plugin\ViewsPluginManager
  911. */
  912. function hook_views_plugins_argument_default_alter(array &$plugins) {
  913. // Remove the available plugin because the users should not have access to it.
  914. unset($plugins['php']);
  915. }
  916. /**
  917. * Modify the list of available views argument validation plugins.
  918. *
  919. * This hook may be used to modify plugin properties after they have been
  920. * specified by other modules.
  921. *
  922. * @param array $plugins
  923. * An array of all the existing plugin definitions, passed by reference.
  924. *
  925. * @see \Drupal\views\Plugin\ViewsPluginManager
  926. */
  927. function hook_views_plugins_argument_validator_alter(array &$plugins) {
  928. // Remove the available plugin because the users should not have access to it.
  929. unset($plugins['php']);
  930. }
  931. /**
  932. * Modify the list of available views cache plugins.
  933. *
  934. * This hook may be used to modify plugin properties after they have been
  935. * specified by other modules.
  936. *
  937. * @param array $plugins
  938. * An array of all the existing plugin definitions, passed by reference.
  939. *
  940. * @see \Drupal\views\Plugin\ViewsPluginManager
  941. */
  942. function hook_views_plugins_cache_alter(array &$plugins) {
  943. // Change the title.
  944. $plugins['time']['title'] = t('Custom title');
  945. }
  946. /**
  947. * Modify the list of available views display extender plugins.
  948. *
  949. * This hook may be used to modify plugin properties after they have been
  950. * specified by other modules.
  951. *
  952. * @param array $plugins
  953. * An array of all the existing plugin definitions, passed by reference.
  954. *
  955. * @see \Drupal\views\Plugin\ViewsPluginManager
  956. */
  957. function hook_views_plugins_display_extenders_alter(array &$plugins) {
  958. // Alter the title of an existing plugin.
  959. $plugins['time']['title'] = t('Custom title');
  960. }
  961. /**
  962. * Modify the list of available views display plugins.
  963. *
  964. * This hook may be used to modify plugin properties after they have been
  965. * specified by other modules.
  966. *
  967. * @param array $plugins
  968. * An array of all the existing plugin definitions, passed by reference.
  969. *
  970. * @see \Drupal\views\Plugin\ViewsPluginManager
  971. */
  972. function hook_views_plugins_display_alter(array &$plugins) {
  973. // Alter the title of an existing plugin.
  974. $plugins['rest_export']['title'] = t('Export');
  975. }
  976. /**
  977. * Modify the list of available views exposed form plugins.
  978. *
  979. * This hook may be used to modify plugin properties after they have been
  980. * specified by other modules.
  981. *
  982. * @param array $plugins
  983. * An array of all the existing plugin definitions, passed by reference.
  984. *
  985. * @see \Drupal\views\Plugin\ViewsPluginManager
  986. */
  987. function hook_views_plugins_exposed_form_alter(array &$plugins) {
  988. // Remove the available plugin because the users should not have access to it.
  989. unset($plugins['input_required']);
  990. }
  991. /**
  992. * Modify the list of available views join plugins.
  993. *
  994. * This hook may be used to modify plugin properties after they have been
  995. * specified by other modules.
  996. *
  997. * @param array $plugins
  998. * An array of all the existing plugin definitions, passed by reference.
  999. *
  1000. * @see \Drupal\views\Plugin\ViewsPluginManager
  1001. */
  1002. function hook_views_plugins_join_alter(array &$plugins) {
  1003. // Print out all join plugin names for debugging purposes.
  1004. debug($plugins);
  1005. }
  1006. /**
  1007. * Modify the list of available views join plugins.
  1008. *
  1009. * This hook may be used to modify plugin properties after they have been
  1010. * specified by other modules.
  1011. *
  1012. * @param array $plugins
  1013. * An array of all the existing plugin definitions, passed by reference.
  1014. *
  1015. * @see \Drupal\views\Plugin\ViewsPluginManager
  1016. */
  1017. function hook_views_plugins_pager_alter(array &$plugins) {
  1018. // Remove the sql based plugin to force good performance.
  1019. unset($plugins['full']);
  1020. }
  1021. /**
  1022. * Modify the list of available views query plugins.
  1023. *
  1024. * This hook may be used to modify plugin properties after they have been
  1025. * specified by other modules.
  1026. *
  1027. * @param array $plugins
  1028. * An array of all the existing plugin definitions, passed by reference.
  1029. *
  1030. * @see \Drupal\views\Plugin\ViewsPluginManager
  1031. */
  1032. function hook_views_plugins_query_alter(array &$plugins) {
  1033. // Print out all query plugin names for debugging purposes.
  1034. debug($plugins);
  1035. }
  1036. /**
  1037. * Modify the list of available views row plugins.
  1038. *
  1039. * This hook may be used to modify plugin properties after they have been
  1040. * specified by other modules.
  1041. *
  1042. * @param array $plugins
  1043. * An array of all the existing plugin definitions, passed by reference.
  1044. *
  1045. * @see \Drupal\views\Plugin\ViewsPluginManager
  1046. */
  1047. function hook_views_plugins_row_alter(array &$plugins) {
  1048. // Change the used class of a plugin.
  1049. $plugins['entity:node']['class'] = 'Drupal\node\Plugin\views\row\NodeRow';
  1050. $plugins['entity:node']['module'] = 'node';
  1051. }
  1052. /**
  1053. * Modify the list of available views style plugins.
  1054. *
  1055. * This hook may be used to modify plugin properties after they have been
  1056. * specified by other modules.
  1057. *
  1058. * @param array $plugins
  1059. * An array of all the existing plugin definitions, passed by reference.
  1060. *
  1061. * @see \Drupal\views\Plugin\ViewsPluginManager
  1062. */
  1063. function hook_views_plugins_style_alter(array &$plugins) {
  1064. // Change the theme hook of a plugin.
  1065. $plugins['html_list']['theme'] = 'custom_views_view_list';
  1066. }
  1067. /**
  1068. * Modify the list of available views wizard plugins.
  1069. *
  1070. * This hook may be used to modify plugin properties after they have been
  1071. * specified by other modules.
  1072. *
  1073. * @param array $plugins
  1074. * An array of all the existing plugin definitions, passed by reference.
  1075. *
  1076. * @see \Drupal\views\Plugin\ViewsPluginManager
  1077. */
  1078. function hook_views_plugins_wizard_alter(array &$plugins) {
  1079. // Change the title of a plugin.
  1080. $plugins['node_revision']['title'] = t('Node revision wizard');
  1081. }
  1082. /**
  1083. * Modify the list of available views area handler plugins.
  1084. *
  1085. * This hook may be used to modify handler properties after they have been
  1086. * specified by other modules.
  1087. *
  1088. * @param array $plugins
  1089. * An array of all the existing handler definitions, passed by reference.
  1090. *
  1091. * @see \Drupal\views\Plugin\ViewsHandlerManager
  1092. */
  1093. function hook_views_plugins_area_alter(array &$plugins) {
  1094. // Change the 'title' handler class.
  1095. $plugins['title']['class'] = 'Drupal\\example\\ExampleClass';
  1096. }
  1097. /**
  1098. * Modify the list of available views argument handler plugins.
  1099. *
  1100. * This hook may be used to modify handler properties after they have been
  1101. * specified by other modules.
  1102. *
  1103. * @param array $plugins
  1104. * An array of all the existing handler definitions, passed by reference.
  1105. *
  1106. * @see \Drupal\views\Plugin\ViewsHandlerManager
  1107. */
  1108. function hook_views_plugins_argument_alter(array &$plugins) {
  1109. // Change the 'title' handler class.
  1110. $plugins['title']['class'] = 'Drupal\\example\\ExampleClass';
  1111. }
  1112. /**
  1113. * Modify the list of available views field handler plugins.
  1114. *
  1115. * This hook may be used to modify handler properties after they have been
  1116. * specified by other modules.
  1117. *
  1118. * @param array $plugins
  1119. * An array of all the existing handler definitions, passed by reference.
  1120. *
  1121. * @see \Drupal\views\Plugin\ViewsHandlerManager
  1122. */
  1123. function hook_views_plugins_field_alter(array &$plugins) {
  1124. // Change the 'title' handler class.
  1125. $plugins['title']['class'] = 'Drupal\\example\\ExampleClass';
  1126. }
  1127. /**
  1128. * Modify the list of available views filter handler plugins.
  1129. *
  1130. * This hook may be used to modify handler properties after they have been
  1131. * specified by other modules.
  1132. *
  1133. * @param array $plugins
  1134. * An array of all the existing handler definitions, passed by reference.
  1135. *
  1136. * @see \Drupal\views\Plugin\ViewsHandlerManager
  1137. */
  1138. function hook_views_plugins_filter_alter(array &$plugins) {
  1139. // Change the 'title' handler class.
  1140. $plugins['title']['class'] = 'Drupal\\example\\ExampleClass';
  1141. }
  1142. /**
  1143. * Modify the list of available views relationship handler plugins.
  1144. *
  1145. * This hook may be used to modify handler properties after they have been
  1146. * specified by other modules.
  1147. *
  1148. * @param array $plugins
  1149. * An array of all the existing handler definitions, passed by reference.
  1150. *
  1151. * @see \Drupal\views\Plugin\ViewsHandlerManager
  1152. */
  1153. function hook_views_plugins_relationship_alter(array &$plugins) {
  1154. // Change the 'title' handler class.
  1155. $plugins['title']['class'] = 'Drupal\\example\\ExampleClass';
  1156. }
  1157. /**
  1158. * Modify the list of available views sort handler plugins.
  1159. *
  1160. * This hook may be used to modify handler properties after they have been
  1161. * specified by other modules.
  1162. *
  1163. * @param array $plugins
  1164. * An array of all the existing handler definitions, passed by reference.
  1165. *
  1166. * @see \Drupal\views\Plugin\ViewsHandlerManager
  1167. */
  1168. function hook_views_plugins_sort_alter(array &$plugins) {
  1169. // Change the 'title' handler class.
  1170. $plugins['title']['class'] = 'Drupal\\example\\ExampleClass';
  1171. }
  1172. /**
  1173. * @} End of "addtogroup hooks".
  1174. */
  1175. /**
  1176. * @}
  1177. */

Functions

Namesort descending Description
hook_field_views_data Override the default Views data for a Field API field.
hook_field_views_data_alter Alter the Views data for a single Field API field.
hook_field_views_data_views_data_alter Alter the Views data on a per field basis.
hook_views_analyze Analyze a view to provide warnings about its configuration.
hook_views_data Describe data tables and fields (or the equivalent) to Views.
hook_views_data_alter Alter the table and field information from hook_views_data().
hook_views_form_substitutions Replace special strings when processing a view with form elements.
hook_views_invalidate_cache Allow modules to respond to the invalidation of the Views cache.
hook_views_plugins_access_alter Modify the list of available views access plugins.
hook_views_plugins_area_alter Modify the list of available views area handler plugins.
hook_views_plugins_argument_alter Modify the list of available views argument handler plugins.
hook_views_plugins_argument_default_alter Modify the list of available views default argument plugins.
hook_views_plugins_argument_validator_alter Modify the list of available views argument validation plugins.
hook_views_plugins_cache_alter Modify the list of available views cache plugins.
hook_views_plugins_display_alter Modify the list of available views display plugins.
hook_views_plugins_display_extenders_alter Modify the list of available views display extender plugins.
hook_views_plugins_exposed_form_alter Modify the list of available views exposed form plugins.
hook_views_plugins_field_alter Modify the list of available views field handler plugins.
hook_views_plugins_filter_alter Modify the list of available views filter handler plugins.
hook_views_plugins_join_alter Modify the list of available views join plugins.
hook_views_plugins_pager_alter Modify the list of available views join plugins.
hook_views_plugins_query_alter Modify the list of available views query plugins.
hook_views_plugins_relationship_alter Modify the list of available views relationship handler plugins.
hook_views_plugins_row_alter Modify the list of available views row plugins.
hook_views_plugins_sort_alter Modify the list of available views sort handler plugins.
hook_views_plugins_style_alter Modify the list of available views style plugins.
hook_views_plugins_wizard_alter Modify the list of available views wizard plugins.
hook_views_post_build Act on the view immediately after the query is built.
hook_views_post_execute Act on the view immediately after the query has been executed.
hook_views_post_render Post-process any rendered data.
hook_views_preview_info_alter Alter the view preview information.
hook_views_pre_build Act on the view before the query is built, but after displays are attached.
hook_views_pre_execute Act on the view after the query is built and just before it is executed.
hook_views_pre_render Act on the view immediately before rendering it.
hook_views_pre_view Alter a view at the very beginning of Views processing.
hook_views_query_alter Alter the query before it is executed.
hook_views_query_substitutions Replace special strings in the query before it is executed.
hook_views_ui_display_top_links_alter Alter the links displayed at the top of the view edit form.