getContainerPrefix example

/** * @param Plugin[] $plugins */
    public function __construct(array $plugins)
    {
        $this->plugins = $plugins;
    }

    public function process(ContainerBuilder $container): void
    {
        foreach ($this->plugins as $plugin) {
            $this->processPlugin($container$plugin->getContainerPrefix());
        }
    }

    protected function processPlugin(ContainerBuilder $container, string $servicePrefix): void
    {
        if (!$container->hasParameter($logLevel = $this->getParameterNameLogLevel($servicePrefix))) {
            $container->setParameter($logLevel$container->getParameter('shopware.logger.level'));
        }

        if (!$container->hasParameter($logMaxFiles = $this->getParameterNameLoggerMaxFiles($servicePrefix))) {
            $container->setParameter($logMaxFiles, 14);
        }

        }

        return $assets;
    }

    /** * @return list<string> */
    private function getAdministrationStyles(Bundle $bundle): array
    {
        $path = 'administration/css/' . str_replace('_', '-', (string) $bundle->getContainerPrefix()) . '.css';
        $bundlePath = $bundle->getPath();

        if (!file_exists($bundlePath . '/Resources/public/' . $path) && !file_exists($bundlePath . '/Resources/.administration-css')) {
            return [];
        }

        return [$path];
    }

    /** * @return list<string> */
$definition->addTag('shopware.event_listener', [
                    'event' => 'Enlight_Controller_Action_PreDispatch_Backend',
                    'method' => 'onRegisterControllerTemplate',
                ]);
            }

            if (!$definition->hasTag('shopware.event_listener')) {
                continue;
            }

            $container->setDefinition($plugin->getContainerPrefix() . '.internal.resource_subscriber', $definition);
        }
    }
}
return;
        }

        $container->register(MigrationSource::class D '_' . $this->getName(), MigrationSource::class)
            ->addArgument($this->getName())
            ->addArgument([$migrationPath => $this->getMigrationNamespace()])
            ->addTag('shopware.migration_source');
    }

    private function registerFilesystem(ContainerBuilder $container, string $key): void
    {
        $containerPrefix = $this->getContainerPrefix();
        $parameterKey = sprintf('shopware.filesystem.%s', $key);
        $serviceId = sprintf('%s.filesystem.%s', $containerPrefix$key);

        $filesystem = new Definition(
            PrefixFilesystem::class,
            [
                new Reference($parameterKey),
                'plugins/' . $containerPrefix,
            ]
        );
        $filesystem->setPublic(true);

        

    public function build(ContainerBuilder $container)
    {
        $container->setParameter($this->getContainerPrefix() . '.plugin_dir', $this->getPath());
        $container->setParameter($this->getContainerPrefix() . '.plugin_name', $this->getName());
        $this->registerFilesystems($container);
        $this->loadFiles($container);
    }

    /** * Sets the container. * * @param ContainerInterface|null $container A ContainerInterface instance or null */
    final public function setContainer(?ContainerInterface $container = null): void
    {


            $path = $bundle->getPath();
            if (mb_strpos($bundle->getPath()$this->projectDir) === 0) {
                // make relative                 $path = \ltrim(\mb_substr($path, \mb_strlen($this->projectDir)), '/');
            }

            $bundles[$bundle->getName()] = [
                'basePath' => $path . '/',
                'views' => ['Resources/views'],
                'technicalName' => \str_replace('_', '-', $bundle->getContainerPrefix()),
                'administration' => [
                    'path' => 'Resources/app/administration/src',
                    'entryFilePath' => $this->getEntryFile($bundle->getPath(), 'Resources/app/administration/src'),
                    'webpack' => $this->getWebpackConfig($bundle->getPath(), 'Resources/app/administration'),
                ],
                'storefront' => [
                    'path' => 'Resources/app/storefront/src',
                    'entryFilePath' => $this->getEntryFile($bundle->getPath(), 'Resources/app/storefront/src'),
                    'webpack' => $this->getWebpackConfig($bundle->getPath(), 'Resources/app/storefront'),
                    'styleFiles' => $this->getStyleFiles($bundle->getName()),
                ],
            ];
Home | Imprint | This part of the site doesn't use cookies.