setUnpublished()->save(); } /** * {@inheritdoc} */ public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { $key = $object->getEntityType()->getKey('published'); /** @var \Drupal\Core\Entity\EntityInterface $object */ $result = $object->access('update', $account, TRUE) ->andIf($object->$key->access('edit', $account, TRUE)); return $return_as_object ? $result : $result->isAllowed(); } }