private function configureSlideShow(ContainerBuilder $container, $config)
    {
        $registry = $container->getDefinition('ekyna_cms.slide_show.registry');

        $container->setParameter('ekyna_cms.slide_show.static', $config['static']);
        $container->setParameter('ekyna_cms.slide_show.themes', $config['themes']);

        $types = $config['types'];

        if (!isset($types['default'])) {
            $types['default'] = [
                'class'   => Type\DefaultType::class,
                'js_path' => 'ekyna-cms/slide-show/type/default',
                'label'   => 'ekyna_cms.slide.type.default.label',
                'config'  => [],
            ];
        }
        if (!isset($types['hero'])) {
            $types['hero'] = [
                'class'   => Type\HeroType::class,
                'js_path' => 'ekyna-cms/slide-show/type/hero',
                'label'   => 'ekyna_cms.slide.type.hero.label',
                'config'  => [],
            ];
        }

        foreach ($types as $name => $c) {
            $class = $c['class'];
            if (class_exists($class)) {
                $id = "ekyna_cms.slide_show.type.{$name}";
                $definition = new Definition($class, []);
                $container->setDefinition($id, $definition);
            } elseif ($container->hasDefinition($class)) {
                $id = $class;
                $definition = $container->getDefinition($class);
                $class = $definition->getClass();
            } else {
                throw new \InvalidArgumentException("Unexpected slide show type '$class'.");
            }

            if (is_subclass_of($class, Type\AbstractType::class)) {
                $definition->addMethodCall('setMediaRepository', [new Reference('ekyna_media.media.repository')]);
                $definition->addMethodCall('setMediaGenerator', [new Reference('ekyna_media.generator')]);
            }

            $definition->addMethodCall('configure', [
                $name,
                $c['label'],
                $c['js_path'],
                isset($c['config']) ? $c['config'] : [],
            ]);

            $registry->addMethodCall('register', [new Reference($id)]);
        }
    }
private function configureSlideShow(ContainerBuilder $container, $config)
    {
        $registry = $container->getDefinition('ekyna_cms.slide_show.registry');

        $container->setParameter('ekyna_cms.slide_show.static', $config['static']);
        $container->setParameter('ekyna_cms.slide_show.themes', $config['themes']);

        $types = $config['types'];

        if (!isset($types['default'])) {
            $types['default'] = [
                'class'   => Type\DefaultType::class,
                'js_path' => 'ekyna-cms/slide-show/type/default',
                'label'   => 'ekyna_cms.slide.type.default.label',
                'config'  => [],
            ];
        }
        if (!isset($types['hero'])) {
            $types['hero'] = [
                'class'   => Type\HeroType::class,
                'js_path' => 'ekyna-cms/slide-show/type/hero',
                'label'   => 'ekyna_cms.slide.type.hero.label',
                'config'  => [],
            ];
        }

        foreach ($types as $name => $c) {
            $class = $c['class'];
            if (class_exists($class)) {
                $id = "ekyna_cms.slide_show.type.{$name}";
                $definition = new Definition($class, []);
                $container->setDefinition($id, $definition);
            } elseif ($container->hasDefinition($class)) {
                $id = $class;
                $definition = $container->getDefinition($class);
                $class = $definition->getClass();
            } else {
                throw new \InvalidArgumentException("Unexpected slide show type '$class'.");
            }

            if (is_subclass_of($class, Type\AbstractType::class)) {
                $definition->addMethodCall('setMediaRepository', [new Reference('ekyna_media.media.repository')]);
                $definition->addMethodCall('setMediaGenerator', [new Reference('ekyna_media.generator')]);
            }

            $definition->addMethodCall('configure', [
                $name,
                $c['label'],
                $c['js_path'],
                isset($c['config']) ? $c['config'] : [],
            ]);

            $registry->addMethodCall('register', [new Reference($id)]);
        }
    }
private function configureSlideShow ( ContainerBuilder $ container , $ config ) { $ registry = $ container -> getDefinition ( 'ekyna_cms.slide_show.registry' ) ; $ container -> setParameter ( 'ekyna_cms.slide_show.static' , $ config [ 'static' ] ) ; $ container -> setParameter ( 'ekyna_cms.slide_show.themes' , $ config [ 'themes' ] ) ; $ types = $ config [ 'types' ] ; if ( ! isset ( $ types [ 'default' ] ) ) { $ types [ 'default' ] = [ 'class' => Type \ DefaultType :: class , 'js_path' => 'ekyna-cms/slide-show/type/default' , 'label' => 'ekyna_cms.slide.type.default.label' , 'config' => [ ] , ] ; } if ( ! isset ( $ types [ 'hero' ] ) ) { $ types [ 'hero' ] = [ 'class' => Type \ HeroType :: class , 'js_path' => 'ekyna-cms/slide-show/type/hero' , 'label' => 'ekyna_cms.slide.type.hero.label' , 'config' => [ ] , ] ; } foreach ( $ types as $ name => $ c ) { $ class = $ c [ 'class' ] ; if ( class_exists ( $ class ) ) { $ id = "ekyna_cms.slide_show.type.{$name}" ; $ definition = new Definition ( $ class , [ ] ) ; $ container -> setDefinition ( $ id , $ definition ) ; } elseif ( $ container -> hasDefinition ( $ class ) ) { $ id = $ class ; $ definition = $ container -> getDefinition ( $ class ) ; $ class = $ definition -> getClass ( ) ; } else { throw new \ InvalidArgumentException ( "Unexpected slide show type '$class'." ) ; } if ( is_subclass_of ( $ class , Type \ AbstractType :: class ) ) { $ definition -> addMethodCall ( 'setMediaRepository' , [ new Reference ( 'ekyna_media.media.repository' ) ] ) ; $ definition -> addMethodCall ( 'setMediaGenerator' , [ new Reference ( 'ekyna_media.generator' ) ] ) ; } $ definition -> addMethodCall ( 'configure' , [ $ name , $ c [ 'label' ] , $ c [ 'js_path' ] , isset ( $ c [ 'config' ] ) ? $ c [ 'config' ] : [ ] , ] ) ; $ registry -> addMethodCall ( 'register' , [ new Reference ( $ id ) ] ) ; } }
Configures slide show.

@param ContainerBuilder $container
@param                  $config
Configures slide show .