You are here

public function AvatarKitServiceStorage::loadMultipleGenerator in Avatar Kit 8.2

Loads services on demand as a generator is iterated.

If an invalid ID is passed, then it is ignored.

Parameters

string[] $service_ids: An array of service plugin ID's.

Return value

\Generator|\Drupal\avatars\Plugin\Avatars\Service\AvatarKitServiceInterface[] Creates service plugins on demand.

Overrides AvatarKitServiceStorageInterface::loadMultipleGenerator

File

src/Entity/AvatarKitServiceStorage.php, line 15

Class

AvatarKitServiceStorage
Controller class for user roles.

Namespace

Drupal\avatars\Entity

Code

public function loadMultipleGenerator(array $service_ids) {
  foreach ($service_ids as $service_id) {

    /** @var \Drupal\avatars\Entity\AvatarKitServiceInterface $service */
    $service = $this
      ->load($service_id);
    if ($service) {
      (yield $service_id => $service
        ->getPlugin());
    }
  }
}