Skip to content
Snippets Groups Projects
Commit 55d01de5 authored by dpi's avatar dpi
Browse files

Fixed compatibility with Drupal8-rc1

Removed $langcode parameter from access controllers and hooks - https://www.drupal.org/node/2581447

Fixed #61
parent e238d4c7
No related branches found
Tags 6.0.0-alpha1
No related merge requests found
......@@ -28,7 +28,7 @@ function rng_help($route_name, RouteMatchInterface $route_match) {
/**
* Implements hook_entity_access().
*/
function rng_entity_access(EntityInterface $entity, $operation, AccountInterface $account, $langcode) {
function rng_entity_access(EntityInterface $entity, $operation, AccountInterface $account) {
if ($operation == 'manage event') {
/** @var \Drupal\rng\EventTypeInterface $event_type */
$event_type = \Drupal::service('rng.event_manager')
......
......@@ -11,20 +11,24 @@ use Drupal\Core\Access\AccessResult;
use Drupal\Core\Entity\EntityAccessControlHandler;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\rng\RuleInterface;
/**
* Access controller for the events and related entities.
* Access controller for the rules and rule components.
*/
class EventAccessControlHandler extends EntityAccessControlHandler {
/**
* {@inheritdoc}
*/
protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
$account = $this->prepareUser($account);
$child = $entity->getEntityTypeId() != 'rng_rule_component' ? $entity : $entity->getRule();
$child = $entity instanceof RuleInterface ? $entity : $entity->getRule();
if ($child instanceof EntityInterface) {
return $child->getEvent()->access('manage event', $account, TRUE);
/** @var $child RuleInterface|\Drupal\rng\RuleComponentInterface */
return $child
->getEvent()
->access('manage event', $account, TRUE);
}
return AccessResult::neutral();
}
......
......@@ -23,7 +23,7 @@ class GroupAccessControlHandler extends EntityAccessControlHandler {
* @param \Drupal\rng\GroupInterface $entity
* A group entity.
*/
protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
$account = $this->prepareUser($account);
$event = $entity->getEvent();
......
......@@ -45,7 +45,7 @@ class RegistrationAccessControlHandler extends EntityAccessControlHandler {
* @param \Drupal\rng\RegistrationInterface $entity
* A registration entity.
*/
protected function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
$account = $this->prepareUser($account);
if (!$account->isAnonymous() && in_array($operation, array('view', 'update', 'delete'))) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment