You are here

function spaces_views_data_alter in Spaces 7

Same name and namespace in other branches
  1. 6.3 includes/spaces.views.inc \spaces_views_data_alter()
  2. 6 includes/spaces.views.inc \spaces_views_data_alter()
  3. 6.2 includes/spaces.views.inc \spaces_views_data_alter()
  4. 7.3 includes/spaces.views.inc \spaces_views_data_alter()

Implements hook_views_data_alter().

File

includes/spaces.views.inc, line 88

Code

function spaces_views_data_alter(&$data) {

  // Add type filter by current feature.
  $data['node']['feature'] = array(
    'group' => t('Spaces'),
    'title' => t('Node type in current feature'),
    'help' => t('Filters on node types associated with the current spaces feature.'),
    'filter' => array(
      'field' => 'type',
      'handler' => 'spaces_handler_filter_spaces_feature',
    ),
  );

  // Iterate through Views data and replace instances of
  // views_handler_field_node with spaces node handler.
  foreach ($data as $table => $data_table) {
    foreach ($data_table as $field => $data_field) {
      if (isset($data_field['field']['handler']) && $data_field['field']['handler'] === 'views_handler_field_node') {
        $data[$table][$field]['field']['handler'] = 'spaces_handler_field_node';
      }
    }
  }
}