public function InlineEditingDisabler::entityViewAlter in Workbench Moderation 8.2
Same name and namespace in other branches
- 8 src/InlineEditingDisabler.php \Drupal\workbench_moderation\InlineEditingDisabler::entityViewAlter()
Implements hook_entity_view_alter().
File
- src/
InlineEditingDisabler.php, line 33
Class
- InlineEditingDisabler
- Disables the inline editing for entities with forward revisions.
Namespace
Drupal\workbench_moderationCode
public function entityViewAlter(&$build, EntityInterface $entity, EntityViewDisplayInterface $display) {
if ($this->moderationInfo
->isModeratableEntity($entity) && !$this->moderationInfo
->isLatestRevision($entity)) {
// Hide quickedit, because its super confusing for the user to not edit the
// live revision.
unset($build['#attributes']['data-quickedit-entity-id']);
}
}