protected function ActivityAccessControlHandler::checkIfPersonalNotification in Open Social 8
Same name and namespace in other branches
- 8.9 modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::checkIfPersonalNotification()
- 8.2 modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::checkIfPersonalNotification()
- 8.3 modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::checkIfPersonalNotification()
- 8.4 modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::checkIfPersonalNotification()
- 8.5 modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::checkIfPersonalNotification()
- 8.6 modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::checkIfPersonalNotification()
- 8.7 modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::checkIfPersonalNotification()
- 8.8 modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::checkIfPersonalNotification()
- 10.3.x modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::checkIfPersonalNotification()
- 10.0.x modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::checkIfPersonalNotification()
- 10.1.x modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::checkIfPersonalNotification()
- 10.2.x modules/custom/activity_creator/src/ActivityAccessControlHandler.php \Drupal\activity_creator\ActivityAccessControlHandler::checkIfPersonalNotification()
Check if this is a personal notification.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: Entity object.
Return value
bool Returns TRUE if entity is personal notification, FALSE if it isn't.
1 call to ActivityAccessControlHandler::checkIfPersonalNotification()
- ActivityAccessControlHandler::checkAccess in modules/
custom/ activity_creator/ src/ ActivityAccessControlHandler.php - Performs access checks.
File
- modules/
custom/ activity_creator/ src/ ActivityAccessControlHandler.php, line 90
Class
- ActivityAccessControlHandler
- Access controller for the Activity entity.
Namespace
Drupal\activity_creatorCode
protected function checkIfPersonalNotification(EntityInterface $entity) {
$recipient = $entity
->getRecipient();
$value = FALSE;
if (!empty($recipient) && $recipient['0']['target_type'] === 'user') {
// This could be personalised, but first lets check the destinations.
$destinations = $entity
->getDestinations();
$is_notification = in_array('notifications', $destinations);
// It is only personal if the only destination is notifications.
if (count($destinations) <= 1 && $is_notification === TRUE) {
$value = TRUE;
}
}
return $value;
}