protected function EntityUsageTrackBase::isApplicable in Entity Usage 8.3
Detects whether this plugin should act on a particular entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity we are interested in.
Return value
bool TRUE if this entity has at least one field this plugin can track, or FALSE otherwise.
2 calls to EntityUsageTrackBase::isApplicable()
- EntityUsageTrackBase::trackOnEntityCreation in src/
EntityUsageTrackBase.php - Track usage updates on the creation of entities.
- EntityUsageTrackBase::trackOnEntityUpdate in src/
EntityUsageTrackBase.php - Track usage updates on the edition of entities.
File
- src/
EntityUsageTrackBase.php, line 276
Class
- EntityUsageTrackBase
- Base implementation for track plugins.
Namespace
Drupal\entity_usageCode
protected function isApplicable(EntityInterface $entity) {
if (!$entity instanceof FieldableEntityInterface) {
return FALSE;
}
$trackable_field_types = $this
->getApplicableFieldTypes();
$fields = array_keys($this
->getReferencingFields($entity, $trackable_field_types));
foreach ($fields as $field_name) {
if ($entity
->hasField($field_name)) {
return TRUE;
}
}
return FALSE;
}