You are here

function feedapi_node_views_views_tables in FeedAPI 5

Implementation of hook_views_tables().

File

feedapi_node_views/feedapi_node_views.module, line 11

Code

function feedapi_node_views_views_tables() {
  $tables['feedapi_node_item'] = array(
    'name' => 'feedapi_node_item',
    'join' => array(
      'left' => array(
        'table' => 'node',
        'field' => 'nid',
      ),
      'right' => array(
        'field' => 'nid',
      ),
    ),
    'fields' => array(
      'url' => array(
        'name' => t('FeedAPI node: Original url'),
        'handler' => 'feedapi_node_views_handler_field_url',
        'help' => t('The original url for a feed item'),
        'option' => array(
          '#type' => 'select',
          '#options' => array(
            'title_link' => t('Item\'s Title with link'),
            'link' => t('With link'),
            'nolink' => t('Without link'),
          ),
        ),
      ),
    ),
    'sorts' => array(
      'timestamp' => array(
        'name' => t('FeedAPI node: Time of the news item'),
        'handler' => 'views_handler_sort_data',
        'option' => views_handler_sort_date_options(),
        'help' => t('Sort by the arrival date for a feed item.'),
      ),
    ),
  );
  $tables['feedapi_node_item_feed'] = array(
    'name' => 'feedapi_node_item_feed',
    'join' => array(
      'left' => array(
        'table' => 'node',
        'field' => 'nid',
      ),
      'right' => array(
        'field' => 'feed_item_nid',
      ),
    ),
    'fields' => array(
      'feed_nid' => array(
        'name' => t('FeedAPI node: Parent feed'),
        'handler' => 'feedapi_node_views_handler_field_feed_nid',
        'option' => array(
          '#type' => 'select',
          '#options' => array(
            'link' => 'As link',
            'nolink_to_feeds' => 'As link to feeds',
            'link_to_site' => 'As link to site',
            'nolink' => 'Without link',
          ),
        ),
      ),
    ),
    'filters' => array(
      'feed_nid' => array(
        'name' => t('FeedAPI node: Parent Feed ID'),
        'option' => 'integer',
        'operator' => views_handler_operator_gtlt(),
        'help' => t('This allows you to filter feed items based on parent feed. You should supply the feed\'s nid.'),
      ),
      'feed_nid_title' => array(
        'name' => t('FeedAPI Item: Parent Feed Title'),
        'field' => 'feed_nid',
        'list' => 'feedapi_views_handler_filter_feed_title',
        'list-type' => 'list',
        'operator' => 'views_handler_operator_or',
        'value-type' => 'array',
        'help' => t('This allows you to filter feed items based on parent feed title.'),
      ),
    ),
  );
  return $tables;
}