You are here

public function EntityHelper::getEntityInstanceBundleName in Simple XML sitemap 4.x

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/Entity/EntityHelper.php, line 75

Class

EntityHelper
Helper class for working with entities.

Namespace

Drupal\simple_sitemap\Entity

Code

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