public static function EntityUsageSourceLevel::isBottomLevel in Entity Usage 8.3
Checks whether an entity is a bottom-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 bottom-level entity, FALSE otherwise.
Overrides EntityUsageSourceLevelInterface::isBottomLevel
2 calls to EntityUsageSourceLevel::isBottomLevel()
- EntityUsageSourceLevel::isMiddleLevel in src/
EntityUsageSourceLevel.php - Checks whether an entity is a middle-level entity.
- EntityUsageTrackBase::getAllBottomLevelTargets in src/
EntityUsageTrackBase.php - Calculates all bottom-level targets for a given entity.
File
- src/
EntityUsageSourceLevel.php, line 40
Class
- EntityUsageSourceLevel
- Defines the interface for the service managing top-level source entities.
Namespace
Drupal\entity_usageCode
public static function isBottomLevel(EntityInterface $entity) {
// If the entity has the usage tab configured, we consider it bottom.
$types_with_local_task = \Drupal::config('entity_usage.settings')
->get('local_task_enabled_entity_types') ?: [];
return in_array($entity
->getEntityTypeId(), $types_with_local_task);
}