/** * @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); }
/** * @inheritdoc */ public function getContent() { $formulae = []; $themes = $this->themeManager->getAllThemes(); foreach ($themes as $theme) { $formulae += $this->collectThemeAssets($theme); } return $formulae; }
/** * 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); }
/** * @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; }
/** * {@inheritdoc} */ public function getData(ContextInterface $context) { return $this->themeManager->getTheme($context->get('theme')); }