You are here

public static function EntityHelper::extractLabels in Commerce Core 8.2

Extracts the labels of the given entities.

Parameters

\Drupal\Core\Entity\EntityInterface[] $entities: The entities.

Return value

array The entity labels.

14 calls to EntityHelper::extractLabels()
commerce_checkout_form_commerce_order_type_form_alter in modules/checkout/commerce_checkout.module
Implements hook_form_FORM_ID_alter() for 'commerce_order_type_form'.
commerce_product_type_labels in modules/product/commerce_product.module
Gets the list of available product type labels.
CustomerProfile::buildOptions in modules/order/src/Plugin/Commerce/InlineForm/CustomerProfile.php
Builds the list of options for the given address book profiles.
EntitySelect::processEntitySelect in src/Element/EntitySelect.php
Process callback.
OrderItemTypeForm::form in modules/order/src/Form/OrderItemTypeForm.php
Gets the actual form array to be built.

... See full list

File

src/EntityHelper.php, line 32

Class

EntityHelper

Namespace

Drupal\commerce

Code

public static function extractLabels(array $entities) : array {
  return array_map(function ($entity) {

    /** @var \Drupal\Core\Entity\EntityInterface $entity */
    return $entity
      ->label();
  }, $entities);
}