You are here

class MainContentRenderersPass in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Render/MainContent/MainContentRenderersPass.php \Drupal\Core\Render\MainContent\MainContentRenderersPass

Adds main_content_renderers parameter to the container.

Hierarchy

Expanded class hierarchy of MainContentRenderersPass

1 file declares its use of MainContentRenderersPass
CoreServiceProvider.php in core/lib/Drupal/Core/CoreServiceProvider.php
Contains \Drupal\Core\CoreServiceProvider.

File

core/lib/Drupal/Core/Render/MainContent/MainContentRenderersPass.php, line 16
Contains \Drupal\Core\Render\MainContent\MainContentRenderersPass.

Namespace

Drupal\Core\Render\MainContent
View source
class MainContentRenderersPass implements CompilerPassInterface {

  /**
   * {@inheritdoc}
   *
   * Collects the available main content renderer service IDs into the
   * main_content_renderers parameter, keyed by format.
   */
  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);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MainContentRenderersPass::process public function Collects the available main content renderer service IDs into the main_content_renderers parameter, keyed by format. Overrides CompilerPassInterface::process