public function ChildEntityWarning::getWarning in Entity Reference Hierarchy 3.x
Same name and namespace in other branches
- 8.2 src/Information/ChildEntityWarning.php \Drupal\entity_hierarchy\Information\ChildEntityWarning::getWarning()
Gets warning message for deleting a parent.
Return value
\Drupal\Core\StringTranslation\PluralTranslatableMarkup Warning message.
File
- src/
Information/ ChildEntityWarning.php, line 79
Class
- ChildEntityWarning
- Defines a value object for a child entity warning.
Namespace
Drupal\entity_hierarchy\InformationCode
public function getWarning() {
if ($this->parent) {
return new PluralTranslatableMarkup($this->relatedEntities
->count() - 1, 'This Test entity has 1 child, deleting this item will change its parent to be @parent.', 'This Test entity has @count children, deleting this item will change their parent to be @parent.', [
'@parent' => $this->relatedEntities
->offsetGet($this->parent)
->label(),
]);
}
return new PluralTranslatableMarkup($this->relatedEntities
->count(), 'This Test entity has 1 child, deleting this item will move that item to the root of the hierarchy.', 'This Test entity has @count children, deleting this item will move those items to the root of the hierarchy.');
}