views_ui.api.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /**
  3. * @file
  4. * Describes hooks provided by the Views UI module.
  5. */
  6. /**
  7. * @addtogroup hooks
  8. * @{
  9. */
  10. /**
  11. * Alter the top of the display for the Views UI.
  12. *
  13. * This hook can be implemented by themes.
  14. *
  15. * @param array[] $build
  16. * Render array for the display top.
  17. * @param \Drupal\views_ui\ViewUI $view
  18. * The view being edited.
  19. * @param string $display_id
  20. * The display ID.
  21. *
  22. * @todo Until https://www.drupal.org/project/drupal/issues/3087455 is resolved,
  23. * use this hook or hook_views_ui_display_tab_alter() instead of
  24. * hook_form_view_edit_form_alter().
  25. *
  26. * @see \Drupal\views_ui\ViewUI::renderDisplayTop()
  27. */
  28. function hook_views_ui_display_top_alter(&$build, \Drupal\views_ui\ViewUI $view, $display_id) {
  29. $build['custom']['#markup'] = 'This text should always appear';
  30. }
  31. /**
  32. * Alter the renderable array representing the edit page for one display.
  33. *
  34. * This hook can be implemented by themes.
  35. *
  36. * @param array[] $build
  37. * Render array for the tab contents.
  38. * @param \Drupal\views_ui\ViewUI $view
  39. * The view being edited.
  40. * @param string $display_id
  41. * The display ID.
  42. *
  43. * @todo Until https://www.drupal.org/project/drupal/issues/3087455 is resolved,
  44. * use this hook or hook_views_ui_display_tab_alter() instead of
  45. * hook_form_view_edit_form_alter().
  46. *
  47. * @see \Drupal\views_ui\ViewEditForm::getDisplayTab()
  48. */
  49. function hook_views_ui_display_tab_alter(&$build, \Drupal\views_ui\ViewUI $view, $display_id) {
  50. $build['custom']['#markup'] = 'This text should always appear';
  51. }
  52. /**
  53. * Alter the links displayed at the top of the view edit form.
  54. *
  55. * @param array $links
  56. * A renderable array of links which will be displayed at the top of the
  57. * view edit form. Each entry will be in a form suitable for
  58. * '#theme' => 'links'.
  59. * @param \Drupal\views\ViewExecutable $view
  60. * The view object being edited.
  61. * @param string $display_id
  62. * The ID of the display being edited, e.g. 'default' or 'page_1'.
  63. *
  64. * @see \Drupal\views_ui\ViewUI::renderDisplayTop()
  65. */
  66. function hook_views_ui_display_top_links_alter(array &$links, ViewExecutable $view, $display_id) {
  67. // Put the export link first in the list.
  68. if (isset($links['export'])) {
  69. $links = ['export' => $links['export']] + $links;
  70. }
  71. }
  72. /**
  73. * @} End of "addtogroup hooks".
  74. */