function PublishAction::access
Same name in other branches
- 9 core/lib/Drupal/Core/Action/Plugin/Action/PublishAction.php \Drupal\Core\Action\Plugin\Action\PublishAction::access()
- 10 core/lib/Drupal/Core/Action/Plugin/Action/PublishAction.php \Drupal\Core\Action\Plugin\Action\PublishAction::access()
- 11.x core/lib/Drupal/Core/Action/Plugin/Action/PublishAction.php \Drupal\Core\Action\Plugin\Action\PublishAction::access()
Overrides ActionInterface::access
1 call to PublishAction::access()
- ModerationOptOutPublish::access in core/
modules/ content_moderation/ src/ Plugin/ Action/ ModerationOptOutPublish.php - Checks object access.
1 method overrides PublishAction::access()
- ModerationOptOutPublish::access in core/
modules/ content_moderation/ src/ Plugin/ Action/ ModerationOptOutPublish.php - Checks object access.
File
-
core/
lib/ Drupal/ Core/ Action/ Plugin/ Action/ PublishAction.php, line 28
Class
- PublishAction
- Publishes an entity.
Namespace
Drupal\Core\Action\Plugin\ActionCode
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();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.