You are here

function fontyourface_ui_views_data in @font-your-face 7.2

Implements hook_views_data().

File

modules/fontyourface_ui/fontyourface_ui.module, line 199

Code

function fontyourface_ui_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',
      ),
      'field' => array(
        'handler' => 'views_handler_field_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_fontyourface_provider',
      ),
      '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_fontyourface_foundry',
      ),
      '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',
      ),
    ),
    'preview' => array(
      'field' => array(
        'title' => t('Preview'),
        'help' => t('Provide a preview of the font.'),
        'handler' => 'views_handler_field_fontyourface_preview',
      ),
    ),
    'enable_disable_link' => array(
      'field' => array(
        'title' => t('Enable/Disable'),
        'help' => t('Link to enable or disable the font.'),
        'handler' => 'views_handler_field_fontyourface_enable_disable',
      ),
    ),
    'enabled_yes_no' => array(
      'field' => array(
        'title' => t('Enabled Yes/No'),
        'help' => t('For use in class or ID names.'),
        'handler' => 'views_handler_field_fontyourface_enabled_yes_no',
      ),
    ),
  );
  $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;
}