You are here

class LayoutPreviewAccessAllowed in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/Access/LayoutPreviewAccessAllowed.php \Drupal\layout_builder\Access\LayoutPreviewAccessAllowed
  2. 9 core/modules/layout_builder/src/Access/LayoutPreviewAccessAllowed.php \Drupal\layout_builder\Access\LayoutPreviewAccessAllowed

Accessible class to allow access for inline blocks in the Layout Builder.

@internal Tagged services are internal.

Hierarchy

Expanded class hierarchy of LayoutPreviewAccessAllowed

2 files declare their use of LayoutPreviewAccessAllowed
BlockComponentRenderArray.php in core/modules/layout_builder/src/EventSubscriber/BlockComponentRenderArray.php
BlockComponentRenderArrayTest.php in core/modules/layout_builder/tests/src/Unit/BlockComponentRenderArrayTest.php

File

core/modules/layout_builder/src/Access/LayoutPreviewAccessAllowed.php, line 15

Namespace

Drupal\layout_builder\Access
View source
class LayoutPreviewAccessAllowed implements AccessibleInterface {

  /**
   * {@inheritdoc}
   */
  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
    if ($operation === 'view') {
      return $return_as_object ? AccessResult::allowed() : TRUE;
    }

    // The layout builder preview should only need 'view' access.
    return $return_as_object ? AccessResult::forbidden() : FALSE;
  }

}

Members