class LayoutPreviewAccessAllowed

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/Access/LayoutPreviewAccessAllowed.php \Drupal\layout_builder\Access\LayoutPreviewAccessAllowed
  2. 10 core/modules/layout_builder/src/Access/LayoutPreviewAccessAllowed.php \Drupal\layout_builder\Access\LayoutPreviewAccessAllowed
  3. 11.x 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

Title Sort descending Modifiers Object type Summary Overriden Title
LayoutPreviewAccessAllowed::access public function Checks data value access. Overrides AccessibleInterface::access

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.