public static function EntityReferenceIntegrityEntityHandler::getAccessDeniedReason in Entity Reference Integrity 8
Build an access denied reason string.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity that has dependents.
bool $translate: Optional boolean to translate the string. Defaults to TRUE.
Return value
string
Overrides EntityReferenceDependencyManagerInterface::getAccessDeniedReason
3 calls to EntityReferenceIntegrityEntityHandler::getAccessDeniedReason()
- EntityReferenceDependencyManager::getAccessDeniedReason in src/
EntityReferenceDependencyManager.php - Build an access denied reason string.
- entity_reference_integrity_enforce_entity_access in modules/
entity_reference_integrity_enforce/ entity_reference_integrity_enforce.module - Implements hook_entity_access().
- JsonApiTest::testApiResourceDelete in modules/
entity_reference_integrity_enforce/ tests/ src/ Functional/ JsonApiTest.php - Test deleting the referenced node via the API.
File
- src/
EntityReferenceIntegrityEntityHandler.php, line 128
Class
- EntityReferenceIntegrityEntityHandler
- Entity reference integrity entity handler.
Namespace
Drupal\entity_reference_integrityCode
public static function getAccessDeniedReason($entity, $translate = TRUE) {
$reason = new TranslatableMarkup('Can not delete the @entity_type_label %entity_label as it is being referenced by another entity.', [
'@entity_type_label' => $entity
->getEntityType()
->getLabel(),
'%entity_label' => $entity
->label(),
]);
return $translate ? $reason
->render() : $reason
->getUntranslatedString();
}