class ParagraphsTypeAccessControlHandler

Defines the access control handler for the Paragraphs type entity type.

Hierarchy

Expanded class hierarchy of ParagraphsTypeAccessControlHandler

See also

\Drupal\paragraphs\Entity\ParagraphsType

File

paragraphs/src/ParagraphsTypeAccessControlHandler.php, line 15

Namespace

Drupal\paragraphs
View source
class ParagraphsTypeAccessControlHandler extends EntityAccessControlHandler {

  /**
   * {@inheritdoc}
   */
  protected $viewLabelOperation = TRUE;

  /**
   * {@inheritdoc}
   */
  protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
    switch ($operation) {
      case 'view label':
        return AccessResult::allowedIfHasPermission($account, 'access content');
      default:
        return parent::checkAccess($entity, $operation, $account);
    }
  }

}

Members