Пример #1
0
 /**
  * This function handles the configuration inheritance for the synchronization.
  * The function handles the inheritance over a recursive call.
  *
  * First this function is called with the theme which should be synchronized.
  * If the theme uses a inheritance configuration, the
  * function resolves the theme parent and calls the "createConfig" function
  * of the Theme.php.
  * The Form\Container\TabContainer won't be initialed again, so each
  * inheritance level becomes the same container instance passed into their
  * createConfig() function.
  *
  * This allows the developer to display the theme configuration of extened
  * themes.
  *
  * @param Theme $theme
  * @param Form\Container\TabContainer $container
  * @return Form\Container\TabContainer
  */
 private function injectConfig(Theme $theme, Form\Container\TabContainer $container)
 {
     //check if theme wants to inject parent configuration
     if (!$theme->useInheritanceConfig() || $theme->getExtend() == null) {
         return;
     }
     /**@var $template Shop\Template */
     $template = $this->repository->findOneBy(array('template' => $theme->getTemplate()));
     //no parent configured? cancel injection.
     if (!$template->getParent()) {
         return;
     }
     //get Theme.php instance of the parent template
     $parent = $this->util->getThemeByTemplate($template->getParent());
     $this->injectConfig($parent, $container);
     $parent->createConfig($container);
 }
Пример #2
0
 /**
  * Helper function which returns the theme information of the
  * passed theme.
  * Used to update the Shopware\Models\Shop\Template entity with
  * the theme data.
  *
  * @param Theme $theme
  * @return array
  */
 private function getThemeDefinition(Theme $theme)
 {
     return array('template' => $theme->getTemplate(), 'name' => $theme->getName(), 'author' => $theme->getAuthor(), 'license' => $theme->getLicense(), 'description' => $theme->getDescription(), 'version' => 3, 'esi' => true, 'style' => true, 'emotion' => true);
 }