bundle/DependencyInjection/Compiler/LocationFactoryPass.php
public function process(ContainerBuilder $container): void
    {
        if (!$container->has('ngsite.menu.factory.location')) {
            return;
        }

        $factory = $container->findDefinition('ngsite.menu.factory.location');

        $extensions = [];

        foreach ($container->findTaggedServiceIds('ngsite.menu.factory.location.extension') as $extension => $tags) {
            foreach ($tags as $tag) {
                $priority = (int) ($tag[0]['priority'] ?? 0);
                $extensions[$priority][] = new Reference($extension);
            }
        }

        krsort($extensions);
        $extensions = array_merge(...$extensions);

        $factory->replaceArgument(2, $extensions);
    }
public function process(ContainerBuilder $container): void
    {
        if (!$container->has('ngsite.menu.factory.location')) {
            return;
        }

        $factory = $container->findDefinition('ngsite.menu.factory.location');

        $extensions = [];

        foreach ($container->findTaggedServiceIds('ngsite.menu.factory.location.extension') as $extension => $tags) {
            foreach ($tags as $tag) {
                $priority = (int) ($tag[0]['priority'] ?? 0);
                $extensions[$priority][] = new Reference($extension);
            }
        }

        krsort($extensions);
        $extensions = array_merge(...$extensions);

        $factory->replaceArgument(2, $extensions);
    }
public function process ( ContainerBuilder $ container ) : void { if ( ! $ container -> has ( 'ngsite.menu.factory.location' ) ) { return ; } $ factory = $ container -> findDefinition ( 'ngsite.menu.factory.location' ) ; $ extensions = [ ] ; foreach ( $ container -> findTaggedServiceIds ( 'ngsite.menu.factory.location.extension' ) as $ extension => $ tags ) { foreach ( $ tags as $ tag ) { $ priority = ( int ) ( $ tag [ 0 ] [ 'priority' ] ?? 0 ) ; $ extensions [ $ priority ] [ ] = new Reference ( $ extension ) ; } } krsort ( $ extensions ) ; $ extensions = array_merge ( ... $ extensions ) ; $ factory -> replaceArgument ( 2 , $ extensions ) ; }
Injects location factory extensions into the factory.
Injects location factory extensions into the factory .