You are here

function domain_entity_views_data_alter in Domain Access Entity 7

Implements hook_views_data_alter().

File

./domain_entity.module, line 283
Defines field (e.g. domain_entity) for entities, and access query alter.

Code

function domain_entity_views_data_alter(&$data) {
  if (module_exists('domain_views')) {
    $entity_base_tables = domain_entity_allowed_entity_types_base_tables();
    if (empty($entity_base_tables)) {
      return;
    }
    foreach ($entity_base_tables as $entity_base_table => $entity_infos) {
      $field_instance = domain_entity_entity_field_instance($entity_infos['entity type']);
      $help = t("This field contains the domain's of the !entity_type.", array(
        '!entity_type' => $entity_infos['entity type'],
      ));
      $title = t('Domain (domain entity)');

      // Domain id filtering.
      $data['field_data_' . $field_instance['name']][$field_instance['name'] . '_domain_id']['filter']['handler'] = 'domain_entity_views_handler_filter_domain_domain_id';
      $data['field_data_' . $field_instance['name']][$field_instance['name'] . '_domain_id']['title'] = $title;
      $data['field_data_' . $field_instance['name']][$field_instance['name'] . '_domain_id']['help'] .= $help;
      $data['field_revision_' . $field_instance['name']][$field_instance['name'] . '_domain_id']['filter']['handler'] = 'domain_entity_views_handler_filter_domain_domain_id';
      $data['field_revision_' . $field_instance['name']][$field_instance['name'] . '_domain_id']['title'] = $title;
    }
  }
}