3 namespace Drupal\Core\Render\MainContent;
5 use Symfony\Component\DependencyInjection\ContainerBuilder;
6 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
9 * Adds main_content_renderers parameter to the container.
11 class MainContentRenderersPass implements CompilerPassInterface {
16 * Collects the available main content renderer service IDs into the
17 * main_content_renderers parameter, keyed by format.
19 public function process(ContainerBuilder $container) {
20 $main_content_renderers = [];
21 foreach ($container->findTaggedServiceIds('render.main_content_renderer') as $id => $attributes_list) {
22 foreach ($attributes_list as $attributes) {
23 $format = $attributes['format'];
24 $main_content_renderers[$format] = $id;
27 $container->setParameter('main_content_renderers', $main_content_renderers);