private function TcaSettingsManager::getEntity in Token Content Access 8
Same name and namespace in other branches
- 2.0.x src/TcaSettingsManager.php \Drupal\tca\TcaSettingsManager::getEntity()
Get entity.
Parameters
string $entity_type_id: The entity type (e.g. node) as a string.
string $entity_id: The entity ID as a string.
Return value
Drupal\Core\Entity\EntityInterface The entity.
2 calls to TcaSettingsManager::getEntity()
- TcaSettingsManager::loadSettingsAsConfig in src/
TcaSettingsManager.php - Load settings for an entity or bundle, or load the defaults.
- TcaSettingsManager::saveSettings in src/
TcaSettingsManager.php - Save settings for an entity or bundle.
File
- src/
TcaSettingsManager.php, line 123
Class
- TcaSettingsManager
- Class TcaSettingsManager.
Namespace
Drupal\tcaCode
private function getEntity($entity_type_id, $entity_id) {
$entity_storage = $this->entityTypeManager
->getStorage($entity_type_id);
if ($entity_storage && $entity_id) {
$entity = $entity_storage
->load($entity_id);
if ($entity && is_subclass_of($entity, 'Drupal\\Core\\Entity\\ContentEntityBase')) {
if ($entity
->hasField('tca_active') && $entity
->hasField('tca_token')) {
return $entity;
}
}
}
return NULL;
}