public function MainContentRenderersPass::process

public MainContentRenderersPass::process(ContainerBuilder $container)

Collects the available main content renderer service IDs into the main_content_renderers parameter, keyed by format.

Overrides CompilerPassInterface::process

File

core/lib/Drupal/Core/Render/MainContent/MainContentRenderersPass.php, line 19

Class

MainContentRenderersPass
Adds main_content_renderers parameter to the container.

Namespace

Drupal\Core\Render\MainContent

Code

public function process(ContainerBuilder $container) {
  $main_content_renderers = [];
  foreach ($container->findTaggedServiceIds('render.main_content_renderer') as $id => $attributes_list) {
    foreach ($attributes_list as $attributes) {
      $format = $attributes['format'];
      $main_content_renderers[$format] = $id;
    }
  }
  $container->setParameter('main_content_renderers', $main_content_renderers);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!MainContent!MainContentRenderersPass.php/function/MainContentRenderersPass::process/8.1.x