You are here

protected function ActivityAccessControlHandler::returnAccessRelatedObject in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::returnAccessRelatedObject()
  2. 8.2 modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::returnAccessRelatedObject()
  3. 8.3 modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::returnAccessRelatedObject()
  4. 8.4 modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::returnAccessRelatedObject()
  5. 8.5 modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::returnAccessRelatedObject()
  6. 8.6 modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::returnAccessRelatedObject()
  7. 8.7 modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::returnAccessRelatedObject()
  8. 8.8 modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::returnAccessRelatedObject()
  9. 10.3.x modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::returnAccessRelatedObject()
  10. 10.0.x modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::returnAccessRelatedObject()
  11. 10.1.x modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::returnAccessRelatedObject()
  12. 10.2.x modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::returnAccessRelatedObject()

Return access control from the related entity.

1 call to ActivityAccessControlHandler::returnAccessRelatedObject()
ActivityAccessControlHandler::checkAccess in modules/custom/activity_creator/src/ActivityAccessControlHandler.php
Performs access checks.

File

modules/custom/activity_creator/src/ActivityAccessControlHandler.php, line 70

Class

ActivityAccessControlHandler
Access controller for the Activity entity.

Namespace

Drupal\activity_creator

Code

protected function returnAccessRelatedObject(EntityInterface $entity, $operation, $account) {
  $related_object = $entity
    ->get('field_activity_entity')
    ->getValue();
  if (!empty($related_object)) {
    $ref_entity_type = $related_object['0']['target_type'];
    $ref_entity_id = $related_object['0']['target_id'];
    $ref_entity = entity_load($ref_entity_type, $ref_entity_id);
    return AccessResult::allowedIf($ref_entity
      ->access($operation, $account));
  }
}