Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / lib / Drupal / Core / Render / MainContent / MainContentRenderersPass.php
1 <?php
2
3 namespace Drupal\Core\Render\MainContent;
4
5 use Symfony\Component\DependencyInjection\ContainerBuilder;
6 use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
8 /**
9  * Adds main_content_renderers parameter to the container.
10  */
11 class MainContentRenderersPass implements CompilerPassInterface {
12
13   /**
14    * {@inheritdoc}
15    *
16    * Collects the available main content renderer service IDs into the
17    * main_content_renderers parameter, keyed by format.
18    */
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;
25       }
26     }
27     $container->setParameter('main_content_renderers', $main_content_renderers);
28   }
29
30 }