public function ContainerBuilder::findTaggedServiceIds

Returns service ids for a given tag.

Example:

$container->register('foo')->addTag('my.tag', array('hello' => 'world'));

$serviceIds = $container->findTaggedServiceIds('my.tag'); foreach ($serviceIds as $serviceId => $tags) { foreach ($tags as $tag) { echo $tag['hello']; } }

@api

Parameters

string $name The tag name:

Return value

array An array of tags with the tagged service as key, holding a list of attribute arrays.

Overrides TaggedContainerInterface::findTaggedServiceIds

File

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php, line 1037

Class

ContainerBuilder
ContainerBuilder is a DI container that provides an API to easily describe services.

Namespace

Symfony\Component\DependencyInjection

Code

public function findTaggedServiceIds($name) {
  $tags = array();
  foreach ($this
    ->getDefinitions() as $id => $definition) {
    if ($definition
      ->hasTag($name)) {
      $tags[$id] = $definition
        ->getTag($name);
    }
  }
  return $tags;
}