From a72097c58d37edee048a0adcb71cf179966f48c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Haas?= <juergen.haas@lakedrops.com> Date: Thu, 24 Oct 2024 10:32:38 +0000 Subject: [PATCH] Issue #3482670 by jurgenhaas, richard cheung: Provide access denied reason on FieldUpdateActionBase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 471e38223a4757c363129ea88b0c188af6e886f0) 471e3822 Issue #3482670 by jurgenhaas, richard cheung: Provide access denied reason on FieldUpdateActionBase Co-authored-by: Jürgen Haas <21467-jurgenhaas@users.noreply.drupalcode.org> --- modules/content/src/Plugin/Action/FieldUpdateActionBase.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/content/src/Plugin/Action/FieldUpdateActionBase.php b/modules/content/src/Plugin/Action/FieldUpdateActionBase.php index 04b40db89..45c9c9825 100644 --- a/modules/content/src/Plugin/Action/FieldUpdateActionBase.php +++ b/modules/content/src/Plugin/Action/FieldUpdateActionBase.php @@ -6,7 +6,7 @@ use Drupal\Component\Plugin\ConfigurableInterface; use Drupal\Component\Plugin\DependentPluginInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Access\AccessResultInterface; -use Drupal\Core\Access\AccessibleInterface; +use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\FieldableEntityInterface; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; @@ -482,11 +482,11 @@ abstract class FieldUpdateActionBase extends ActionBase implements ConfigurableI */ public function access($object, ?AccountInterface $account = NULL, $return_as_object = FALSE): bool|AccessResultInterface { $result = AccessResult::forbidden(); - if (!($object instanceof AccessibleInterface)) { + if (!($object instanceof EntityInterface)) { + $result->setReason('No entity provided.'); return $return_as_object ? $result : $result->isAllowed(); } - /** @var \Drupal\Core\Entity\EntityInterface $entity */ $entity = $object; $entity_op = 'update'; -- GitLab