You are here

public function EntityHelper::getEntityInstanceBundleName in Simple XML sitemap 8.3

Same name and namespace in other branches
  1. 8.2 src/EntityHelper.php \Drupal\simple_sitemap\EntityHelper::getEntityInstanceBundleName()

Gets an entity's bundle name.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to get the bundle name for.

Return value

string The bundle of the entity.

File

src/EntityHelper.php, line 79

Class

EntityHelper
Helper class for working with entities.

Namespace

Drupal\simple_sitemap

Code

public function getEntityInstanceBundleName(EntityInterface $entity) {
  return $entity
    ->getEntityTypeId() === 'menu_link_content' ? $entity
    ->getMenuName() : $entity
    ->bundle();
}