diff --git a/src/Plugin/PanelsStorage/PanelizerFieldPanelsStorage.php b/src/Plugin/PanelsStorage/PanelizerFieldPanelsStorage.php index 15efcb6..39f5da4 100644 --- a/src/Plugin/PanelsStorage/PanelizerFieldPanelsStorage.php +++ b/src/Plugin/PanelsStorage/PanelizerFieldPanelsStorage.php @@ -167,7 +167,7 @@ class PanelizerFieldPanelsStorage extends PanelsStorageBase implements Container ]; // Do not add entity cacheability metadata to the forbidden result, // because it depends on the Panels operation, and not on the entity. - $access->orIf(isset($entity_operations[$op]) ? $entity->access($entity_operations[$op], $account) : AccessResult::forbidden()); + $access->orIf(isset($entity_operations[$op]) ? $entity->access($entity_operations[$op], $account, TRUE) : AccessResult::forbidden()); if (!$access->isForbidden() && $entity instanceof FieldableEntityInterface) { list (,, $view_mode) = explode(':', $id); diff --git a/tests/src/Unit/PanelizerFieldPanelsStorageTest.php b/tests/src/Unit/PanelizerFieldPanelsStorageTest.php index 367a82a..035e375 100644 --- a/tests/src/Unit/PanelizerFieldPanelsStorageTest.php +++ b/tests/src/Unit/PanelizerFieldPanelsStorageTest.php @@ -211,8 +211,8 @@ class PanelizerFieldPanelsStorageTest extends UnitTestCase { $account = $this->prophesize(AccountInterface::class); $entity = $this->prophesize(FieldableEntityInterface::class); - $entity->access('read', $account->reveal()) - ->willReturn(TRUE); + $entity->access('view', $account->reveal(), TRUE) + ->willReturn(AccessResult::allowed()); $this->storage->load('123')->willReturn($entity->reveal()); @@ -245,8 +245,8 @@ class PanelizerFieldPanelsStorageTest extends UnitTestCase { $account = $this->prophesize(AccountInterface::class); $entity = $this->prophesize(FieldableEntityInterface::class); - $entity->access('update', $account->reveal()) - ->willReturn(TRUE); + $entity->access('update', $account->reveal(), TRUE) + ->willReturn(AccessResult::allowed()); $this->storage->load('123')->willReturn($entity->reveal()); @@ -255,7 +255,8 @@ class PanelizerFieldPanelsStorageTest extends UnitTestCase { $this->panelizer->hasEntityPermission('change content', $entity->reveal(), 'view_mode', $account->reveal()) ->willReturn(TRUE); - $this->assertEquals(AccessResult::allowed(), $this->panelsStorage->access('entity_type_id:123:view_mode', 'update', $account->reveal())); + $access = $this->panelsStorage->access('entity_type_id:123:view_mode', 'update', $account->reveal()); + $this->assertEquals(AccessResult::allowed(), $access); } /** @@ -266,8 +267,8 @@ class PanelizerFieldPanelsStorageTest extends UnitTestCase { $account = $this->prophesize(AccountInterface::class); $entity = $this->prophesize(FieldableEntityInterface::class); - $entity->access('update', $account->reveal()) - ->willReturn(TRUE); + $entity->access('update', $account->reveal(), TRUE) + ->willReturn(AccessResult::allowed()); $this->storage->load('123')->willReturn($entity->reveal());