Pull merge.
[yaffs-website] / web / core / modules / layout_builder / src / Access / LayoutPreviewAccessAllowed.php
1 <?php
2
3 namespace Drupal\layout_builder\Access;
4
5 use Drupal\Core\Access\AccessibleInterface;
6 use Drupal\Core\Access\AccessResult;
7 use Drupal\Core\Session\AccountInterface;
8
9 /**
10  * Accessible class to allow access for inline blocks in the Layout Builder.
11  *
12  * @internal
13  */
14 class LayoutPreviewAccessAllowed implements AccessibleInterface {
15
16   /**
17    * {@inheritdoc}
18    */
19   public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
20     if ($operation === 'view') {
21       return $return_as_object ? AccessResult::allowed() : TRUE;
22     }
23     // The layout builder preview should only need 'view' access.
24     return $return_as_object ? AccessResult::forbidden() : FALSE;
25   }
26
27 }