You are here

function vms_views_data_alter in Views Menu Support 7

Same name and namespace in other branches
  1. 8 vms.views.inc \vms_views_data_alter()

Implements hook_views_data_alter().

File

./vms.views.inc, line 24
Declares the Views plugin for inheriting argument value.

Code

function vms_views_data_alter(&$data) {

  // Get a list of all integer fields on the site – only these should be used
  // for MLID filtering.
  foreach (field_info_fields() as $field) {
    if ($field['type'] == 'number_integer') {

      // Get a quick alias for the field name, for readability.
      $field =& $field['field_name'];
      $data['field_data_' . $field]['vms_' . $field] = array(
        'group' => t('MLID filtering'),
        'title' => t('@field', array(
          '@field' => $field,
        )),
        'field' => $field . '_value',
        'filter' => array(
          'field' => $field . '_value',
          'table' => 'field_data_' . $field,
          'help' => t('A filter treating the field as a MLID value, matching it
            against active menu link IDs.'),
          'handler' => 'vms_handler_filter_mlid',
        ),
      );
    }
  }
}