You are here

public function CommerceAddToCartLinkViewsField::query in Commerce Add To Cart Link 8

Same name and namespace in other branches
  1. 2.x src/Plugin/views/field/CommerceAddToCartLinkViewsField.php \Drupal\commerce_add_to_cart_link\Plugin\views\field\CommerceAddToCartLinkViewsField::query()

Called to add the field to a query.

Overrides LinkBase::query

File

src/Plugin/views/field/CommerceAddToCartLinkViewsField.php, line 120

Class

CommerceAddToCartLinkViewsField
Defines a Views field that adds an add to cart link.

Namespace

Drupal\commerce_add_to_cart_link\Plugin\views\field

Code

public function query() {

  // @see \Drupal\views\Plugin\views\field\FieldPluginBase::query
  $this
    ->ensureMyTable();

  // Add the field.
  $params = $this->options['group_type'] != 'group' ? [
    'function' => $this->options['group_type'],
  ] : [];
  $this->field_alias = $this->query
    ->addField($this->tableAlias, $this->realField, NULL, $params);
  parent::query();
}