You are here

class views_handler_relationship_fontyourface_tag in @font-your-face 6.2

Same name and namespace in other branches
  1. 7.2 modules/fontyourface_ui/views/views_handler_relationship_fontyourface_tag.inc \views_handler_relationship_fontyourface_tag
  2. 7 views/views_handler_relationship_fontyourface_tag.inc \views_handler_relationship_fontyourface_tag

@file Views handler.

Hierarchy

Expanded class hierarchy of views_handler_relationship_fontyourface_tag

File

views/views_handler_relationship_fontyourface_tag.inc, line 8
Views handler.

View source
class views_handler_relationship_fontyourface_tag extends views_handler_relationship {

  /**
   * Called to implement a relationship in a query.
   */
  function query() {
    $this
      ->ensure_my_table();
    $def = $this->definition;
    $def['table'] = 'fontyourface_tag';
    if (!empty($this->options['required'])) {
      $tag_font = $this->query
        ->add_table('fontyourface_tag_font', $this->relationship);
      $def['left_table'] = $tag_font;
      $def['left_field'] = 'tid';
      $def['field'] = 'tid';
      if (!empty($this->options['required'])) {
        $def['type'] = 'INNER';
      }

      // if
    }
    else {

      // If the join is optional, join a subselect that will emulate fontyourface_tag_font table instead.
      $def['left_table'] = $this->table_alias;
      $def['left_field'] = 'fid';
      $def['field'] = 'font';
      $def['table formula'] = "(\n        SELECT t.*, tf.fid AS font\n        FROM {fontyourface_tag} t\n        INNER JOIN {fontyourface_tag_font} tf\n          ON t.tid = tf.tid\n      )";
    }

    // else
    $join = new views_join();
    $join->definition = $def;
    $join
      ->construct();
    $join->adjusted = TRUE;

    // use a short alias for this:
    $alias = $def['table'] . '_' . $this->table;
    $this->alias = $this->query
      ->add_relationship($alias, $join, 'fontyourface_tag', $this->relationship);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
views_handler_relationship_fontyourface_tag::query function Called to implement a relationship in a query.