You are here

function views_handler_field_amazon_image::ensure_my_table in Amazon Product Advertisement API 7

Same name and namespace in other branches
  1. 6 includes/views_handler_field_amazon_image.inc \views_handler_field_amazon_image::ensure_my_table()
  2. 7.2 includes/views_handler_field_amazon_image.inc \views_handler_field_amazon_image::ensure_my_table()

Ensure the main table for this handler is in the query. This is used a lot.

Overrides views_handler::ensure_my_table

File

includes/views_handler_field_amazon_image.inc, line 34
Provide views handler so that Amazon Image can be displayed in the various ways that are available.

Class

views_handler_field_amazon_image
@file Provide views handler so that Amazon Image can be displayed in the various ways that are available.

Code

function ensure_my_table() {
  if (empty($this->table_alias)) {
    $join_extra = array();
    if (!empty($this->options['image_size'])) {
      $join_extra[] = array(
        'field' => 'size',
        'value' => $this->options['image_size'],
        'numeric' => FALSE,
      );
    }
    $join = new views_join();
    $join
      ->construct($this->table, 'amazon_item', 'asin', 'asin', $join_extra);
    $this->table_alias = $this->query
      ->ensure_table($this->table, $this->relationship, $join);
  }
  return $this->table_alias;
}