protected function CourierMessageController::composeAnyIdentityForChannel in Courier 8
Same name and namespace in other branches
- 2.x courier_message_composer/src/Controller/CourierMessageController.php \Drupal\courier_message_composer\Controller\CourierMessageController::composeAnyIdentityForChannel()
Determines if the current user can compose a message for any identity type.
Parameters
string $channel: A channel entity type ID.
Return value
bool If the current user can compose a message for any identity type.
1 call to CourierMessageController::composeAnyIdentityForChannel()
- CourierMessageController::channelList in courier_message_composer/
src/ Controller/ CourierMessageController.php - Return a list of links to channels.
File
- courier_message_composer/
src/ Controller/ CourierMessageController.php, line 91
Class
- CourierMessageController
- Returns responses for CourierMessageController routes.
Namespace
Drupal\courier_message_composer\ControllerCode
protected function composeAnyIdentityForChannel($channel) {
$channels = $this->identityChannelManager
->getChannels();
if (array_key_exists($channel, $channels)) {
foreach ($channels[$channel] as $identity) {
$permission = "courier_message_composer compose {$channel} to {$identity}";
if ($this
->currentUser()
->hasPermission($permission)) {
return TRUE;
}
}
}
return FALSE;
}