You are here

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

Returns an AccessResult object.

Parameters

\Drupal\paragraphs\ParagraphInterface $paragraph: The paragraph entity.

Return value

bool True if user can edit.

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

File

src/Element/LayoutParagraphsBuilder.php, line 548

Class

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

Namespace

Drupal\layout_paragraphs\Element

Code

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