summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/views_ui/views_ui.api.php
blob: 65b14c6fdbe87b8b9916be3e33432463b9f6e427 (plain) (blame)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php

/**
 * @file
 */

use Drupal\views_ui\ViewUI;

/**
 * @file
 * Describes hooks provided by the Views UI module.
 */

/**
 * @addtogroup hooks
 * @{
 */

/**
 * Alter the top of the display for the Views UI.
 *
 * This hook can be implemented by themes.
 *
 * @param array[] $build
 *   Render array for the display top.
 * @param \Drupal\views_ui\ViewUI $view
 *   The view being edited.
 * @param string $display_id
 *   The display ID.
 *
 * @todo Until https://www.drupal.org/project/drupal/issues/3087455 is resolved,
 *   use this hook or hook_views_ui_display_tab_alter() instead of
 *   hook_form_view_edit_form_alter().
 *
 * @see \Drupal\views_ui\ViewUI::renderDisplayTop()
 */
function hook_views_ui_display_top_alter(&$build, ViewUI $view, $display_id) {
  $build['custom']['#markup'] = 'This text should always appear';
}

/**
 * Alter the renderable array representing the edit page for one display.
 *
 * This hook can be implemented by themes.
 *
 * @param array[] $build
 *   Render array for the tab contents.
 * @param \Drupal\views_ui\ViewUI $view
 *   The view being edited.
 * @param string $display_id
 *   The display ID.
 *
 * @todo Until https://www.drupal.org/project/drupal/issues/3087455 is resolved,
 *   use this hook or hook_views_ui_display_tab_alter() instead of
 *   hook_form_view_edit_form_alter().
 *
 * @see \Drupal\views_ui\ViewEditForm::getDisplayTab()
 */
function hook_views_ui_display_tab_alter(&$build, ViewUI $view, $display_id) {
  $build['custom']['#markup'] = 'This text should always appear';
}

/**
 * Alter the links displayed at the top of the view edit form.
 *
 * @param array $links
 *   A renderable array of links which will be displayed at the top of the
 *   view edit form. Each entry will be in a form suitable for
 *   '#theme' => 'links'.
 * @param \Drupal\views\ViewExecutable $view
 *   The view object being edited.
 * @param string $display_id
 *   The ID of the display being edited, e.g. 'default' or 'page_1'.
 *
 * @see \Drupal\views_ui\ViewUI::renderDisplayTop()
 */
function hook_views_ui_display_top_links_alter(array &$links, ViewExecutable $view, $display_id) {
  // Put the export link first in the list.
  if (isset($links['export'])) {
    $links = ['export' => $links['export']] + $links;
  }
}

/**
 * @} End of "addtogroup hooks".
 */