You are here

public function ProductVariation::getAttributeFieldNames in Commerce Core 8.2

Gets the names of the variation's attribute fields.

Return value

string[] The attribute field names.

Overrides ProductVariationInterface::getAttributeFieldNames

4 calls to ProductVariation::getAttributeFieldNames()
ProductVariation::getAttributeValue in modules/product/src/Entity/ProductVariation.php
Gets the attribute value for the given field name.
ProductVariation::getAttributeValueId in modules/product/src/Entity/ProductVariation.php
Gets the attribute value id for the given field name.
ProductVariation::getAttributeValueIds in modules/product/src/Entity/ProductVariation.php
Gets the attribute value IDs.
ProductVariation::getAttributeValues in modules/product/src/Entity/ProductVariation.php
Gets the attribute values.

File

modules/product/src/Entity/ProductVariation.php, line 283

Class

ProductVariation
Defines the product variation entity class.

Namespace

Drupal\commerce_product\Entity

Code

public function getAttributeFieldNames() {
  $attribute_field_manager = \Drupal::service('commerce_product.attribute_field_manager');
  $field_map = $attribute_field_manager
    ->getFieldMap($this
    ->bundle());
  return array_column($field_map, 'field_name');
}