You are here

public function IdentityChannelManager::getChannelsForIdentity in Courier 8

Same name and namespace in other branches
  1. 2.x src/Service/IdentityChannelManager.php \Drupal\courier\Service\IdentityChannelManager::getChannelsForIdentity()

@todo: Determine channel preference for individual identities. GH-2 | https://github.com/dpi/courier/issues/2

Overrides IdentityChannelManagerInterface::getChannelsForIdentity

File

src/Service/IdentityChannelManager.php, line 103

Class

IdentityChannelManager
Manages discovery and instantiation of CourierIdentity plugins.

Namespace

Drupal\courier\Service

Code

public function getChannelsForIdentity(EntityInterface $identity) {
  $preferences = \Drupal::config('courier.settings')
    ->get('channel_preferences');
  $identity_type = $identity
    ->getEntityTypeId();
  if (array_key_exists($identity_type, $preferences)) {
    return array_intersect($preferences[$identity_type], $this
      ->getChannelsForIdentityType($identity_type));
  }
  return [];
}