function MainContentRenderersPass::process

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Render/MainContent/MainContentRenderersPass.php \Drupal\Core\Render\MainContent\MainContentRenderersPass::process()
  2. 10 core/lib/Drupal/Core/Render/MainContent/MainContentRenderersPass.php \Drupal\Core\Render\MainContent\MainContentRenderersPass::process()
  3. 11.x core/lib/Drupal/Core/Render/MainContent/MainContentRenderersPass.php \Drupal\Core\Render\MainContent\MainContentRenderersPass::process()

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

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.