You are here

function datex_views_data_alter in Datex 7.3

Same name and namespace in other branches
  1. 7 datex.views.inc \datex_views_data_alter()
  2. 7.2 datex.views.inc \datex_views_data_alter()

Implements hook_views_data_alter().

File

./datex.module, line 536
Datex main module file, Datex adds php-intl support to drupal.

Code

function datex_views_data_alter(&$data) {
  foreach ($data as $key => &$value) {
    if (is_array($value)) {
      datex_views_data_alter($value);
      continue;
    }

    // Argument -_______-------------------------------------------------------
    if ($value === 'date_views_argument_handler_simple') {
      $value = '_datex_date_views_argument_handler_simple';
    }

    // Field Formatter --------------------------------------------------------
    $change0 = [
      'views_handler_field_date',
      'views_handler_field_last_comment_timestamp',
      'views_handler_field_history_user_timestamp',
      'views_handler_field_ncs_last_updated',
    ];
    if (in_array($value, $change0, TRUE)) {
      $value = '_datex_' . $value;
    }

    // Contextual filters -----------------------------------------------------
    $change1 = [
      //        'day',
      //        'week',
      //        'month',
      'year',
      'fulldate',
      'year_month',
    ];
    foreach ([
      'views_handler_argument_node_created_',
      'views_handler_argument_node_changed_',
    ] as $item) {
      foreach ($change1 as $g) {
        if ($value === $item . $g) {
          $value = '_datex_' . $value;
        }
      }
    }
  }
}