function ViewsUiTestHooks::viewsPreviewInfoAlter

Implements hook_views_preview_info_alter().

Add a row count row to the live preview area.

Attributes

#[Hook('views_preview_info_alter')]

File

core/modules/views_ui/tests/modules/views_ui_test/src/Hook/ViewsUiTestHooks.php, line 19

Class

ViewsUiTestHooks
Hook implementations for views_ui_test.

Namespace

Drupal\views_ui_test\Hook

Code

public function viewsPreviewInfoAlter(&$rows, $view) : void {
  $data = [
    '#markup' => 'Test row count',
  ];
  $data['#attached']['library'][] = 'views_ui_test/views_ui_test.test';
  $rows['query'][] = [
    [
      'data' => $data,
    ],
    count($view->result),
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.