Exemple #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);
 }