You are here

protected function LayoutParagraphsBuilder::createAccess in Layout Paragraphs 2.0.x

Returns an AccessResult object.

Return value

\Drupal\Core\Access\AccessResultInterface True if user can edit.

1 call to LayoutParagraphsBuilder::createAccess()
LayoutParagraphsBuilder::buildComponent in src/Element/LayoutParagraphsBuilder.php
Returns the build array for a single layout component.

File

src/Element/LayoutParagraphsBuilder.php, line 562

Class

LayoutParagraphsBuilder
Defines a render element for building the Layout Builder UI.

Namespace

Drupal\layout_paragraphs\Element

Code

protected function createAccess() {
  $access = new AccessResultAllowed();
  if ($this
    ->isTranslating() && !$this
    ->supportsAsymmetricTranslations()) {
    $access = new AccessResultForbidden('Cannot add paragraphs while in translation mode.');
  }
  return $access
    ->isAllowed();
}