X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fnode%2Fsrc%2FPlugin%2FAction%2FStickyNode.php;fp=web%2Fcore%2Fmodules%2Fnode%2Fsrc%2FPlugin%2FAction%2FStickyNode.php;h=7aff92bbc9ee964537eb247c86e9fbcefe2adb8e;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/node/src/Plugin/Action/StickyNode.php b/web/core/modules/node/src/Plugin/Action/StickyNode.php new file mode 100644 index 000000000..7aff92bbc --- /dev/null +++ b/web/core/modules/node/src/Plugin/Action/StickyNode.php @@ -0,0 +1,36 @@ +setSticky(TRUE)->save(); + } + + /** + * {@inheritdoc} + */ + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { + /** @var \Drupal\node\NodeInterface $object */ + $access = $object->access('update', $account, TRUE) + ->andif($object->sticky->access('edit', $account, TRUE)); + return $return_as_object ? $access : $access->isAllowed(); + } + +}