You are here

public function BackgroundImageManager::getEntityBundleLabel in Background Image 2.0.x

Same name and namespace in other branches
  1. 8 src/BackgroundImageManager.php \Drupal\background_image\BackgroundImageManager::getEntityBundleLabel()
  2. 2.x src/BackgroundImageManager.php \Drupal\background_image\BackgroundImageManager::getEntityBundleLabel()

Retrieves the bundle label for a given entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to use as the target.

Return value

string|null The bundle label or NULL if it doesn't exist.

Overrides BackgroundImageManagerInterface::getEntityBundleLabel

File

src/BackgroundImageManager.php, line 453

Class

BackgroundImageManager

Namespace

Drupal\background_image

Code

public function getEntityBundleLabel(EntityInterface $entity) {
  $bundles = $info = $this
    ->getEnabledEntityTypeBundles($entity
    ->getEntityType());
  if (isset($bundles[$entity
    ->bundle()]['label'])) {
    return $bundles[$entity
      ->bundle()]['label'];
  }
}