views_test_data.views.inc 1.56 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<?php

/**
 * @file
 * Provides views data and hooks for views_test_data module.
 */

use Drupal\views\Analyzer;
use Drupal\views\ViewExecutable;

/**
 * Implements hook_views_analyze().
 */
function views_test_data_views_analyze(ViewExecutable $view) {
  $ret = array();

  $ret[] = Analyzer::formatMessage(t('Test ok message'), 'ok');
  $ret[] = Analyzer::formatMessage(t('Test warning message'), 'warning');
  $ret[] = Analyzer::formatMessage(t('Test error message'), 'error');

  return $ret;
}
23 24 25 26 27

/**
 * Implements hook_views_data().
 */
function views_test_data_views_data() {
28 29 30 31 32 33 34 35 36 37 38
  $state = Drupal::service('state');
  // We use a state variable to keep track of how many times this function is
  // called so we can assert that calls to
  // \Drupal\views\ViewsDataCache::delete() trigger a rebuild of views data.
  if (!($count = $state->get('views_test_data_views_data_count'))) {
    $count = 0;
  }
  $count++;
  $state->set('views_test_data_views_data_count', $count);

  return $state->get('views_test_data_views_data');
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
}

/**
 * Implements hook_views_data_alter().
 */
function views_test_data_views_data_alter(&$data) {

}

/**
 * Implements hook_views_query_substitutions().
 */
function views_test_data_views_query_substitutions() {

}

/**
 * Implements hook_views_form_substitutions().
 */
function views_test_data_views_form_substitutions() {

}

/**
 * Implements hook_field_views_data().
 */
function views_test_data_field_views_data($field) {

}

/**
 * Implements hook_field_views_data_alter().
 */
function views_test_data_field_views_data_alter(&$data, $field, $module) {

}