You are here

public function InlineEditingDisabler::entityViewAlter in Workbench Moderation 8.2

Same name and namespace in other branches
  1. 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_moderation

Code

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']);
  }
}