3 namespace Drupal\layout_builder\Access;
5 use Drupal\Core\Access\AccessibleInterface;
6 use Drupal\Core\Access\AccessResult;
7 use Drupal\Core\Session\AccountInterface;
10 * Accessible class to allow access for inline blocks in the Layout Builder.
14 class LayoutPreviewAccessAllowed implements AccessibleInterface {
19 public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
20 if ($operation === 'view') {
21 return $return_as_object ? AccessResult::allowed() : TRUE;
23 // The layout builder preview should only need 'view' access.
24 return $return_as_object ? AccessResult::forbidden() : FALSE;