You are here

function synonyms_views_data in Synonyms 7

Same name and namespace in other branches
  1. 2.0.x modules/synonyms_views_field/synonyms_views_field.module \synonyms_views_data()

Implements hook_views_data().

File

views/synonyms.views.inc, line 11
Views integration of Synonyms module.

Code

function synonyms_views_data() {
  $data = array();
  foreach (entity_get_info() as $entity_type => $entity_info) {
    $wrapper = entity_metadata_wrapper($entity_type);
    $property_info = $wrapper
      ->getPropertyInfo();
    if (isset($property_info['synonyms']) && isset($entity_info['base table']) && $entity_info['base table']) {
      $data[$entity_info['base table']]['synonyms'] = array(
        'title' => t('All synonyms'),
        'help' => t('All synonyms of @entity_type', array(
          '@entity_type' => $entity_info['label'],
        )),
        'field' => array(
          'handler' => 'synonyms_views_handler_field_synonyms',
          'real field' => $entity_info['entity keys']['id'],
          'click sortable' => FALSE,
          'synonyms entity type' => $entity_type,
        ),
      );
    }
  }
  return $data;
}