You are here

protected function ProductVariationViewsData::addEntityLinks in Commerce Core 8.2

Sets the entity links in case corresponding link templates exist.

Parameters

array $data: The views data of the base table.

Overrides EntityViewsData::addEntityLinks

File

modules/product/src/ProductVariationViewsData.php, line 15

Class

ProductVariationViewsData
Provides views data for product variations.

Namespace

Drupal\commerce_product

Code

protected function addEntityLinks(array &$data) {
  parent::addEntityLinks($data);
  $t_arguments = [
    '@entity_type_label' => $this->entityType
      ->getLabel(),
  ];

  // EntityViewsData::addEntityLinks() doesn't generate this field
  // because product variations don't have a canonical link template.
  $data['view_commerce_product_variation']['field'] = [
    'title' => $this
      ->t('Link to @entity_type_label', $t_arguments),
    'help' => $this
      ->t('Provide a view link to the @entity_type_label.', $t_arguments),
    'id' => 'commerce_product_variation_view_link',
  ];
}