Mercurial > hg > isophonics-drupal-site
annotate core/modules/layout_builder/src/Access/LayoutPreviewAccessAllowed.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | af1871eacc83 |
children |
rev | line source |
---|---|
Chris@17 | 1 <?php |
Chris@17 | 2 |
Chris@17 | 3 namespace Drupal\layout_builder\Access; |
Chris@17 | 4 |
Chris@17 | 5 use Drupal\Core\Access\AccessibleInterface; |
Chris@17 | 6 use Drupal\Core\Access\AccessResult; |
Chris@17 | 7 use Drupal\Core\Session\AccountInterface; |
Chris@17 | 8 |
Chris@17 | 9 /** |
Chris@17 | 10 * Accessible class to allow access for inline blocks in the Layout Builder. |
Chris@17 | 11 * |
Chris@17 | 12 * @internal |
Chris@18 | 13 * Tagged services are internal. |
Chris@17 | 14 */ |
Chris@17 | 15 class LayoutPreviewAccessAllowed implements AccessibleInterface { |
Chris@17 | 16 |
Chris@17 | 17 /** |
Chris@17 | 18 * {@inheritdoc} |
Chris@17 | 19 */ |
Chris@17 | 20 public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) { |
Chris@17 | 21 if ($operation === 'view') { |
Chris@17 | 22 return $return_as_object ? AccessResult::allowed() : TRUE; |
Chris@17 | 23 } |
Chris@17 | 24 // The layout builder preview should only need 'view' access. |
Chris@17 | 25 return $return_as_object ? AccessResult::forbidden() : FALSE; |
Chris@17 | 26 } |
Chris@17 | 27 |
Chris@17 | 28 } |