eck-8.x-1.x-dev/src/EckBundleAccessControlHandler.php

src/EckBundleAccessControlHandler.php
<?php

namespace Drupal\eck;

use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityAccessControlHandler;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;

/**
 * Access controller for eck bundles.
 *
 * @ingroup eck
 */
class EckBundleAccessControlHandler extends EntityAccessControlHandler {

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

  /**
   * {@inheritdoc}
   */
  public function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
    // We don't treat the bundle label as privileged information.
    if ($operation === 'view label') {
      return AccessResult::allowed();
    }

    return parent::checkAccess($entity, $operation, $account);
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc