/**
  * @param array $themes
  */
 protected function setUpThemeManager(array $themes)
 {
     $map = [];
     foreach ($themes as $themeName => $theme) {
         $map[] = [$themeName, $theme];
     }
     $this->themeManager->expects($this->any())->method('getTheme')->willReturnMap($map);
 }
Example #2
0
 /**
  * @inheritdoc
  */
 public function getContent()
 {
     $formulae = [];
     $themes = $this->themeManager->getAllThemes();
     foreach ($themes as $theme) {
         $formulae += $this->collectThemeAssets($theme);
     }
     return $formulae;
 }
Example #3
0
 /**
  * Returns theme inheritance hierarchy with root theme as first item
  *
  * @param string $themeName
  *
  * @return Theme[]
  */
 protected function getThemesHierarchy($themeName)
 {
     $hierarchy = [];
     while (null !== $themeName) {
         $theme = $this->themeManager->getTheme($themeName);
         $hierarchy[] = $theme;
         $themeName = $theme->getParentTheme();
     }
     return array_reverse($hierarchy);
 }
Example #4
0
 /**
  * @param Theme $theme
  * @return array
  */
 protected function collectThemeAssets(Theme $theme)
 {
     $assets = $theme->getDataByKey('assets', []);
     $parentTheme = $theme->getParentTheme();
     if ($parentTheme) {
         $parentTheme = $this->themeManager->getTheme($parentTheme);
         $assets = array_merge_recursive($this->collectThemeAssets($parentTheme), $assets);
     }
     return $assets;
 }
Example #5
0
 /**
  * {@inheritdoc}
  */
 public function getData(ContextInterface $context)
 {
     return $this->themeManager->getTheme($context->get('theme'));
 }