You are here

function fontyourface_views_data in @font-your-face 6.2

Same name and namespace in other branches
  1. 7 fontyourface.module \fontyourface_views_data()

Implements hook_views_data().

File

./fontyourface.module, line 102

Code

function fontyourface_views_data() {
  $data = array();
  $data['fontyourface_font'] = array(
    'table' => array(
      'group' => t('Font'),
      'base' => array(
        'field' => 'fid',
        'title' => t('Font'),
        'help' => t('Fonts from @font-your-face.'),
      ),
    ),
    'join' => array(
      'fontyourface_tag' => array(
        'left_table' => 'fontyourface_tag_font',
        'left_field' => 'fid',
        'field' => 'fid',
      ),
    ),
    'fid' => array(
      'title' => t('Font ID'),
      'help' => t('Unique ID for a font.'),
      'filter' => array(
        'handler' => 'views_handler_filter_numeric',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_numeric',
      ),
    ),
    'name' => array(
      'title' => t('Name'),
      'help' => t('Name of the font.'),
      'field' => array(
        'handler' => 'views_handler_field_fontyourface_font',
        'click sortable' => TRUE,
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_string',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_string',
      ),
    ),
    'provider' => array(
      'title' => t('Provider'),
      'help' => t('Module providing the font.'),
      'field' => array(
        'handler' => 'views_handler_field_fontyourface_provider',
        'click sortable' => TRUE,
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_string',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_string',
      ),
    ),
    'foundry' => array(
      'title' => t('Foundry'),
      'help' => t('Foundry of the font.'),
      'field' => array(
        'handler' => 'views_handler_field_fontyourface_foundry',
        'click sortable' => TRUE,
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_string',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_string',
      ),
    ),
    'foundry_url' => array(
      'title' => t('Foundry URL'),
      'help' => t('URL of foundry of the font.'),
      'field' => array(
        'handler' => 'views_handler_field_fontyourface_foundry',
        'click sortable' => TRUE,
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_string',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_string',
      ),
    ),
    'license' => array(
      'title' => t('License'),
      'help' => t('License for using the font.'),
      'field' => array(
        'handler' => 'views_handler_field_fontyourface_license',
        'click sortable' => TRUE,
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_string',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_string',
      ),
    ),
    'license_url' => array(
      'title' => t('License URL'),
      'help' => t('URL of license for using the font.'),
      'field' => array(
        'handler' => 'views_handler_field_fontyourface_license',
        'click sortable' => TRUE,
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_string',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_string',
      ),
    ),
    'enabled' => array(
      'title' => t('Enabled'),
      'help' => t('Enabled status for a font.'),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'field' => array(
        'handler' => 'views_handler_field_boolean',
        'click sortable' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_boolean_operator',
        'label' => t('Enabled'),
        'type' => 'yes-no',
      ),
    ),
    'css_family' => array(
      'title' => t('CSS font-family'),
      'help' => t('CSS font-family attribute.'),
      'field' => array(
        'handler' => 'views_handler_field',
        'click sortable' => TRUE,
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_string',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_string',
      ),
    ),
  );
  $data['fontyourface_tag_font'] = array(
    'table' => array(
      'group' => t('Font'),
      'join' => array(
        'fontyourface_font' => array(
          'left_field' => 'fid',
          'field' => 'fid',
        ),
        'fontyourface_tag' => array(
          'left_field' => 'tid',
          'field' => 'tid',
        ),
      ),
    ),
    'tid' => array(
      'title' => t('Font Tag'),
      'help' => t('Get all tags associated with a font.'),
      'field' => array(
        'title' => t('All tags'),
        'help' => t('Display all tags associated with a font.'),
        'handler' => 'views_handler_field_fontyourface_tag_font_tid',
        'skip base' => 'fontyourface_tag',
      ),
      'relationship' => array(
        'handler' => 'views_handler_relationship',
        'base' => 'fontyourface_tag',
        'base field' => 'tid',
        'label' => t('Font Tag'),
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_tag_font_tid',
        'numeric' => TRUE,
        'skip base' => array(
          'fontyourface_font',
        ),
      ),
    ),
    'fid' => array(
      'title' => t('Font'),
      'help' => t('Get all fonts associated with a tag.'),
      'relationship' => array(
        'handler' => 'views_handler_relationship',
        'base' => 'fontyourface_font',
        'base field' => 'fid',
        'label' => t('Font'),
      ),
    ),
  );
  $data['fontyourface_tag'] = array(
    'table' => array(
      'group' => t('Font'),
      'base' => array(
        'field' => 'tid',
        'title' => t('Font Tag'),
        'help' => t('Tags are attached to fonts.'),
      ),
      'join' => array(
        'fontyourface_font' => array(
          'left_table' => 'fontyourface_tag_font',
          'left_field' => 'tid',
          'field' => 'tid',
        ),
        'fontyourface_tag_font' => array(
          'field' => 'tid',
          'left_field' => 'tid',
        ),
      ),
    ),
    'tid' => array(
      'title' => t('Tag ID'),
      'help' => t('A font tag ID'),
      'field' => array(
        'handler' => 'views_handler_field_numeric',
        'click sortable' => TRUE,
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_numeric',
        'skip base' => array(
          'fontyourface_font',
        ),
        'zero is null' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_tag_font_tid',
        'numeric' => TRUE,
        'skip base' => array(
          'fontyourface_font',
        ),
      ),
    ),
    'name' => array(
      'title' => t('Tag'),
      'help' => t('A tag attached to a font.'),
      'field' => array(
        'handler' => 'views_handler_field',
        'click sortable' => TRUE,
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_string',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_string',
      ),
    ),
  );
  return $data;
}