You are here

function asset_views_tables in Asset 5

Same name and namespace in other branches
  1. 5.2 modules/asset_views.inc \asset_views_tables()
  2. 6 asset_views.inc \asset_views_tables()
  3. 6 inc/asset_views.inc \asset_views_tables()
  4. 6 modules/asset_views.inc \asset_views_tables()

File

./asset_views.inc, line 3

Code

function asset_views_tables() {
  $tables['asset_node'] = array(
    'name' => 'asset_node',
    'join' => array(
      'type' => 'inner',
      'left' => array(
        'table' => 'node',
        'field' => 'nid',
      ),
      'right' => array(
        'field' => 'nid',
      ),
    ),
  );
  $tables['asset'] = array(
    'name' => 'asset',
    'join' => array(
      'type' => 'inner',
      'left' => array(
        'table' => 'asset_node',
        'field' => 'aid',
      ),
      'right' => array(
        'field' => 'aid',
      ),
    ),
    'fields' => array(
      'aid' => array(
        'name' => t('Asset'),
        'help' => t('Display the formatted asset. NOTE: If using one of the formatters under <em><strong>Only Available for Specific Extensions</strong></em>, be sure to apply the Asset:Extension filter for the specific extensions that apply to that formatter.'),
        'option' => array(
          '#type' => 'select',
          '#options' => 'asset_views_options_formatters',
        ),
        'handler' => array(
          'asset_views_handler_field_asset' => t('No Link'),
          'asset_views_handler_field_asset_link' => t('Link to asset'),
          'asset_views_handler_field_asset_node_link' => t('Link to node'),
        ),
      ),
      'filename' => array(
        'name' => t('Asset: Filename'),
        'help' => t('Display the filename of the asset.'),
      ),
      'extension' => array(
        'name' => t('Asset: Extension'),
        'help' => t('Display the extension of the asset.'),
      ),
      'dirname' => array(
        'name' => t('Asset: Directory'),
        'help' => t('Display the directory of the asset.'),
      ),
      'filesize' => array(
        'name' => t('Asset: File Size'),
        'help' => t('Display the file size of the asset.'),
      ),
    ),
    'filters' => array(
      'extension' => array(
        'name' => t('Asset: File Extension'),
        'help' => t('Filter by file extension.'),
        'operator' => views_handler_operator_andor(),
        'value' => array(
          '#type' => 'select',
          '#options' => 'asset_views_options_file_extensions',
          '#multiple' => true,
          '#size' => 4,
        ),
      ),
      'type' => array(
        'name' => t('Asset: File Type'),
        'help' => t('Filter by file type.'),
        'operator' => views_handler_operator_andor(),
        'value' => array(
          '#type' => 'select',
          '#options' => 'asset_views_options_file_types',
          '#multiple' => true,
          '#size' => 4,
        ),
      ),
      'dirname' => array(
        'name' => t('Asset: Directory'),
        'help' => t('Filter by an assets parent directory.'),
        'operator' => views_handler_operator_eqneq(),
      ),
      'distinct' => array(
        'name' => t('Asset: Distinct'),
        'operator' => array(
          '=' => 'is',
        ),
        'list' => array(
          'distinct' => 'distinct',
        ),
        'handler' => 'asset_views_handler_filter_distinct',
        'value-type' => 'array',
        'help' => t('This filter ensures that each asset may only be listed once, even if it matches multiple criteria.'),
      ),
    ),
  );
  return $tables;
}