X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FAction%2FPlugin%2FAction%2FPublishAction.php;fp=web%2Fcore%2Flib%2FDrupal%2FCore%2FAction%2FPlugin%2FAction%2FPublishAction.php;h=8d0cf756b47c308abab7c88e2f2c6bd55754a7ec;hp=0000000000000000000000000000000000000000;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/core/lib/Drupal/Core/Action/Plugin/Action/PublishAction.php b/web/core/lib/Drupal/Core/Action/Plugin/Action/PublishAction.php new file mode 100644 index 000000000..8d0cf756b --- /dev/null +++ b/web/core/lib/Drupal/Core/Action/Plugin/Action/PublishAction.php @@ -0,0 +1,38 @@ +setPublished()->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(); + } + +}