You are here

class NgLightboxPass in NG Lightbox 8

Same name and namespace in other branches
  1. 2.x src/NgLightboxPass.php \Drupal\ng_lightbox\NgLightboxPass

The NgLightboxPass class.

Hierarchy

  • class \Drupal\ng_lightbox\NgLightboxPass implements \Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface

Expanded class hierarchy of NgLightboxPass

File

src/NgLightboxPass.php, line 16
Contains \Drupal\ng_lightbox\NgLightboxPass

Namespace

Drupal\ng_lightbox
View source
class NgLightboxPass implements CompilerPassInterface {

  /**
   * {@inheritdoc}
   */
  public function process(ContainerBuilder $container) {
    $lightbox_renderers = [];
    foreach ($container
      ->findTaggedServiceIds('render.main_content_renderer') as $id => $attributes_list) {
      foreach ($attributes_list as $attributes) {
        if (!empty($attributes['ng_lightbox'])) {
          $format = $attributes['format'];
          $lightbox_renderers[$format] = $attributes['ng_lightbox'];
        }
      }
    }
    $container
      ->setParameter('ng_lightbox_renderers', $lightbox_renderers);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
NgLightboxPass::process public function You can modify the container here before it is dumped to PHP code.