class NgLightboxServiceProvider in NG Lightbox 8
Same name and namespace in other branches
- 2.x src/NgLightboxServiceProvider.php \Drupal\ng_lightbox\NgLightboxServiceProvider
The NgLightboxServiceProvider class.
Hierarchy
- class \Drupal\Core\DependencyInjection\ServiceProviderBase implements ServiceModifierInterface, ServiceProviderInterface
- class \Drupal\ng_lightbox\NgLightboxServiceProvider
Expanded class hierarchy of NgLightboxServiceProvider
File
- src/
NgLightboxServiceProvider.php, line 16 - Contains \Drupal\ng_lightbox\NgLightboxServiceProvider
Namespace
Drupal\ng_lightboxView source
class NgLightboxServiceProvider extends ServiceProviderBase {
/**
* {@inheritdoc}
*/
public function register(ContainerBuilder $container) {
$container
->addCompilerPass(new NgLightboxPass());
}
/**
* {@inheritdoc}
*/
public function alter(ContainerBuilder $container) {
$this
->addLightbox($container, 'main_content_renderer.dialog', 'Core Dialog');
$this
->addLightbox($container, 'main_content_renderer.modal', 'Core Modal');
}
/**
* @param \Drupal\Core\DependencyInjection\ContainerBuilder $container
* @param $id
* @param $title
*/
protected function addLightbox(ContainerBuilder $container, $id, $title) {
$definition = $container
->getDefinition($id);
$tags = $definition
->getTags();
foreach ($tags as $delta => &$tag) {
if ($delta === 'render.main_content_renderer') {
foreach ($tag as &$attribute) {
$attribute['ng_lightbox'] = $title;
}
}
}
$definition
->setTags($tags);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NgLightboxServiceProvider:: |
protected | function | ||
NgLightboxServiceProvider:: |
public | function |
Modifies existing service definitions. Overrides ServiceProviderBase:: |
|
NgLightboxServiceProvider:: |
public | function |
Registers services to the container. Overrides ServiceProviderBase:: |