You are here

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

Gets the entity type id for a bundle.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to get an entity type id for a bundle.

Return value

null|string The entity type for a bundle or NULL on failure.

File

src/Entity/EntityHelper.php, line 90

Class

EntityHelper
Helper class for working with entities.

Namespace

Drupal\simple_sitemap\Entity

Code

public function getBundleEntityTypeId(EntityInterface $entity) : ?string {
  return $entity
    ->getEntityTypeId() === 'menu' ? 'menu_link_content' : $entity
    ->getEntityType()
    ->getBundleOf();
}