You are here

function recently_read_views_data_alter in Recently Read 7.3

Same name and namespace in other branches
  1. 8 recently_read.views.inc \recently_read_views_data_alter()
  2. 7.2 includes/recently_read.views.inc \recently_read_views_data_alter()

Implements of hook_views_data_alter().

File

includes/recently_read.views.inc, line 83

Code

function recently_read_views_data_alter(&$data) {
  $info = entity_get_info();
  foreach ($info as $type => $entity) {
    $data['recently_read']['table']['join'] = array(
      $entity['base table'] => array(
        'left_field' => $entity['entity keys']['id'],
        'field' => 'entity_id',
      ),
    );
    $data[$entity['base table']][$type . '_rr_' . $entity['entity keys']['id']] = array(
      'title' => t('Recently Read'),
      'help' => t('Recently Read Relationship'),
      'relationship' => array(
        'group' => 'Recently Read',
        'label' => t('Recently Read'),
        'base' => 'recently_read',
        'base field' => 'entity_id',
        'relationship field' => $entity['entity keys']['id'],
        'handler' => 'views_handler_relationship',
      ),
    );
  }
}