public function ProductAttributeValueStorage::loadMultipleByAttribute in Commerce Core 8.2
Loads product attribute values for the given product attribute.
Parameters
string $attribute_id: The product attribute ID.
Return value
\Drupal\commerce_product\Entity\ProductAttributeValueInterface[] The product attribute values, indexed by id, ordered by weight.
Overrides ProductAttributeValueStorageInterface::loadMultipleByAttribute
File
- modules/
product/ src/ ProductAttributeValueStorage.php, line 15
Class
- ProductAttributeValueStorage
- Defines the product attribute value storage.
Namespace
Drupal\commerce_productCode
public function loadMultipleByAttribute($attribute_id) {
$entity_query = $this
->getQuery();
$entity_query
->accessCheck(FALSE);
$entity_query
->condition('attribute', $attribute_id);
$entity_query
->sort('weight');
$entity_query
->sort('name');
$result = $entity_query
->execute();
return $result ? $this
->loadMultiple($result) : [];
}