You are here

public static function EntityUsageSourceLevel::isTopLevel in Entity Usage 8.3

Checks whether an entity is a top-level entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity object we are dealing with.

Return value

bool TRUE if the entity passed in is a top-level entity, FALSE otherwise.

Overrides EntityUsageSourceLevelInterface::isTopLevel

7 calls to EntityUsageSourceLevel::isTopLevel()
BatchUpdateForm::updateSourcesBatchWorker in src/Form/BatchUpdateForm.php
Batch operation worker for recreating statistics for source entities.
entity_usage_entity_insert in ./entity_usage.module
Implements hook_entity_insert().
entity_usage_entity_predelete in ./entity_usage.module
Implements hook_entity_predelete().
entity_usage_entity_revision_delete in ./entity_usage.module
Implements hook_entity_revision_delete().
entity_usage_entity_translation_delete in ./entity_usage.module
Implements hook_entity_translation_delete().

... See full list

File

src/EntityUsageSourceLevel.php, line 22

Class

EntityUsageSourceLevel
Defines the interface for the service managing top-level source entities.

Namespace

Drupal\entity_usage

Code

public static function isTopLevel(EntityInterface $entity) {

  // @todo Make it easier for sites to override this. Currently the way is to
  // override this service and write this method differently. Maybe it's worth
  // letting sites do this in an easier way.
  return in_array($entity
    ->getEntityTypeId(), self::TOP_LEVEL_TYPES);
}