You are here

public function EntityHelper::getBundleEntityTypeId in Simple XML sitemap 8.3

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

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

Class

EntityHelper
Helper class for working with entities.

Namespace

Drupal\simple_sitemap

Code

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