Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LayoutPreviewAccessAllowed.php

function LayoutPreviewAccessAllowed::access

Overrides AccessibleInterface::access

File

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

Class

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

Namespace

Drupal\layout_builder\Access

Code

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;
}
RSS feed
Powered by Drupal