ECCube4カスタマイズ方法
優先順位
- src/Eccube/Kernel.phpでboot処理を行う。
- サービスや、ルーティングには優先順がある。(以下のコードで後勝ちで設定が上書きされる)
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader) { $confDir = $this->getProjectDir().'/app/config/eccube'; $loader->load($confDir.'/services'.self::CONFIG_EXTS, 'glob'); $loader->load($confDir.'/packages/*'.self::CONFIG_EXTS, 'glob'); if (is_dir($confDir.'/packages/'.$this->environment)) { $loader->load($confDir.'/packages/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob'); } $loader->load($confDir.'/services_'.$this->environment.self::CONFIG_EXTS, 'glob'); // プラグインのservices.phpをロードする. $dir = dirname(__DIR__).'/../app/Plugin/*/Resource/config'; $loader->load($dir.'/services'.self::CONFIG_EXTS, 'glob'); $loader->load($dir.'/services_'.$this->environment.self::CONFIG_EXTS, 'glob'); // カスタマイズディレクトリのservices.phpをロードする. $dir = dirname(__DIR__).'/../app/Customize/Resource/config'; $loader->load($dir.'/services'.self::CONFIG_EXTS, 'glob'); $loader->load($dir.'/services_'.$this->environment.self::CONFIG_EXTS, 'glob'); } protected function configureRoutes(RouteCollectionBuilder $routes) { $container = $this->getContainer(); $scheme = ['https', 'http']; $forceSSL = $container->getParameter('eccube_force_ssl'); if ($forceSSL) { $scheme = 'https'; } $routes->setSchemes($scheme); $confDir = $this->getProjectDir().'/app/config/eccube'; if (is_dir($confDir.'/routes/')) { $builder = $routes->import($confDir.'/routes/*'.self::CONFIG_EXTS, '/', 'glob'); $builder->setSchemes($scheme); } if (is_dir($confDir.'/routes/'.$this->environment)) { $builder = $routes->import($confDir.'/routes/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob'); $builder->setSchemes($scheme); } $builder = $routes->import($confDir.'/routes'.self::CONFIG_EXTS, '/', 'glob'); $builder->setSchemes($scheme); $builder = $routes->import($confDir.'/routes_'.$this->environment.self::CONFIG_EXTS, '/', 'glob'); $builder->setSchemes($scheme); // 有効なプラグインのルーティングをインポートする. $plugins = $container->getParameter('eccube.plugins.enabled'); $pluginDir = $this->getProjectDir().'/app/Plugin'; foreach ($plugins as $plugin) { $dir = $pluginDir.'/'.$plugin.'/Controller'; if (file_exists($dir)) { $builder = $routes->import($dir, '/', 'annotation'); $builder->setSchemes($scheme); } if (file_exists($pluginDir.'/'.$plugin.'/Resource/config')) { $builder = $routes->import($pluginDir.'/'.$plugin.'/Resource/config/routes'.self::CONFIG_EXTS, '/', 'glob'); $builder->setSchemes($scheme); } } }
テンプレートの優先順位
1. ECCUBEROOT/app/template/[template_code] 2. ECCUBEROOT/src/Eccube/Resource/template/[template_code] 3. ECCUBEROOT/app/Plugin