X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fnode%2Fsrc%2FPlugin%2FAction%2FStickyNode.php;h=679c3c019bb8492412c26c2a4b937bacc4441986;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=7aff92bbc9ee964537eb247c86e9fbcefe2adb8e;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;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 index 7aff92bbc..679c3c019 100644 --- a/web/core/modules/node/src/Plugin/Action/StickyNode.php +++ b/web/core/modules/node/src/Plugin/Action/StickyNode.php @@ -2,8 +2,8 @@ namespace Drupal\node\Plugin\Action; -use Drupal\Core\Action\ActionBase; -use Drupal\Core\Session\AccountInterface; +use Drupal\Core\Field\FieldUpdateActionBase; +use Drupal\node\NodeInterface; /** * Makes a node sticky. @@ -14,23 +14,13 @@ use Drupal\Core\Session\AccountInterface; * type = "node" * ) */ -class StickyNode extends ActionBase { +class StickyNode extends FieldUpdateActionBase { /** * {@inheritdoc} */ - public function execute($entity = NULL) { - $entity->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(); + protected function getFieldsToUpdate() { + return ['sticky' => NodeInterface::STICKY]; } }