You are here

function photos_access_views_data in Album Photos 7.3

Same name and namespace in other branches
  1. 8.5 photos_access/photos_access.module \photos_access_views_data()
  2. 8.4 photos_access/photos_access.module \photos_access_views_data()
  3. 6.0.x photos_access/photos_access.module \photos_access_views_data()

Implements hook_views_data().

File

photos_access/photos_access.module, line 753

Code

function photos_access_views_data() {
  $data = array();
  $data['photos_access_album'] = array();
  $data['photos_access_album']['table'] = array();
  $data['photos_access_album']['table']['group'] = t('Album Photo Access');

  // Join album info to images.
  $data['photos_access_album']['table']['join'] = array(
    'photos_album' => array(
      'left_field' => 'pid',
      'field' => 'nid',
      'type' => 'INNER',
    ),
  );

  // Access type field.
  $data['photos_access_album']['viewid'] = array(
    'title' => t('Access Type'),
    'help' => t('This albums Access type.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_in_operator',
      'options callback' => '_photos_access_album_views_options',
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    // Define a relationship to the {photos_access_album} table.
    'relationship' => array(
      'base' => 'photos_album',
      'base field' => 'pid',
      'handler' => 'views_handler_relationship',
      'label' => t('Access Type'),
      'title' => t('The Access Type associated with this album.'),
      'help' => t('Access to the Access Type associated with this album.'),
    ),
  );
  return $data;
}