You are here

vvf.module in Views Variable Field 7

API and main hooks for Views Variable Field module.

File

vvf.module
View source
<?php

/**
 * @file
 * API and main hooks for Views Variable Field module.
 */

/**
 * Implements hook_views_data().
 */
function vvf_views_data() {
  $data['views']['variable'] = array(
    'title' => t('System variable'),
    'help' => t('Extracts a system variable and displays it as a Views field.'),
    'field' => array(
      'handler' => 'views_handler_field_variable',
    ),
  );
  $data['views']['variable_compare'] = array(
    'title' => t('Field against variable comparison'),
    'help' => t('Compare database field against system variable.'),
    'filter' => array(
      'help' => t('Use field against variable comparison to filter the result of the view.'),
      'handler' => 'views_handler_filter_field_variable_compare',
    ),
  );
  return $data;
}

/**
 * Implements hook_features_pipe_COMPONENT_alter() for views_view component.
 */
function vvf_features_pipe_views_view_alter(&$pipe, $data, $export) {
  if (!empty($data)) {
    foreach ($data as $view_name) {
      $view = views_get_view($view_name);
      foreach ($view->display as $display) {
        if (isset($display->display_options['fields'])) {
          foreach ($display->display_options['fields'] as $field) {
            if ($field['id'] == 'variable') {
              $pipe['dependencies'][] = 'vvf';
              return;
            }
          }
        }
      }
    }
  }
}

Functions

Namesort descending Description
vvf_features_pipe_views_view_alter Implements hook_features_pipe_COMPONENT_alter() for views_view component.
vvf_views_data Implements hook_views_data().