Version 1
[yaffs-website] / web / core / lib / Drupal / Core / DependencyInjection / Compiler / RegisterLazyRouteFilters.php
diff --git a/web/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterLazyRouteFilters.php b/web/core/lib/Drupal/Core/DependencyInjection/Compiler/RegisterLazyRouteFilters.php
new file mode 100644 (file)
index 0000000..d774779
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+namespace Drupal\Core\DependencyInjection\Compiler;
+
+use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+
+/**
+ * Registers all lazy route filters onto the lazy route filter.
+ */
+class RegisterLazyRouteFilters implements CompilerPassInterface {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function process(ContainerBuilder $container) {
+    if (!$container->hasDefinition('route_filter.lazy_collector')) {
+      return;
+    }
+
+    $service_ids = [];
+
+    foreach ($container->findTaggedServiceIds('route_filter') as $id => $attributes) {
+      $service_ids[$id] = $id;
+    }
+
+    $container
+      ->getDefinition('route_filter.lazy_collector')
+      ->addArgument($service_ids);
+  }
+
+}