vendor/score/cms/src/Twig/AppRuntime.php line 89

Open in your IDE?
  1. <?php
  2. namespace Score\CmsBundle\Twig;
  3. use Score\BaseBundle\Services\ReactAppLoader;
  4. use Score\BaseBundle\Twig\AppRuntime as BaseAppRuntime;
  5. use Score\CmsBundle\Services\CmsTwigManager;
  6. use Score\CmsBundle\Services\StatManager;
  7. class AppRuntime extends BaseAppRuntime {
  8.     protected $reactAppLoader;
  9.     protected $cmsTwigManager;
  10.     protected $version;
  11.     protected $allTemplates;
  12.     protected $template;
  13.     protected $statManager;
  14.     public function __construct(
  15.         ReactAppLoader $reactAppLoader,
  16.         CmsTwigManager $cmsTwigManager,
  17.         StatManager $statManager,
  18.         $version,
  19.         $allTemplates,
  20.         $template
  21.     ) {
  22.         $this->reactAppLoader = $reactAppLoader;
  23.         $this->cmsTwigManager = $cmsTwigManager;
  24.         $this->statManager = $statManager;
  25.         $this->version = $version;
  26.         $this->allTemplates = $allTemplates;
  27.         $this->template = $template;
  28.     }
  29.     public function getVersion() {
  30.         return $this->version;
  31.     }
  32.     public function loadReactApps(array $apps = []) {
  33.         return $this->reactAppLoader->findAppsByBlockNames($apps);
  34.     }
  35.     public function loadReactAppFiles($extension, $pathToManifest) {
  36.         return $this->reactAppLoader->getFilePaths($extension, $pathToManifest);
  37.     }
  38.     public function getTemplate() {
  39.         if (array_key_exists($this->template, $this->allTemplates)) {
  40.             return $this->allTemplates[$this->template];
  41.         } elseif ($this->template) {
  42.             return $this->template;
  43.         } else {
  44.             return "@ScoreCms/Public/default/layout.html.twig";
  45.         }
  46.     }
  47.     public function getAccordion($id) {
  48.         return $this->cmsTwigManager->getAccordion($id);
  49.     }
  50.     public function replaceAllOptionText($text) {
  51.         return $this->cmsTwigManager->replaceAllOptionText($text);
  52.     }
  53.     public function replaceOptionText($text) {
  54.         return $this->cmsTwigManager->replaceOptionText($text);
  55.     }
  56.     public function replaceWidget($params) {
  57.         return $this->cmsTwigManager->replaceWidget($params);
  58.     }
  59.     public function replaceAllWidgets($text) {
  60.         return $this->cmsTwigManager->replaceAllWidgets($text);
  61.     }
  62.     public function getTopViewedContent() {
  63.         return $this->statManager->getTopViewedContent();
  64.     }
  65.     public function getTopSearchContent() {
  66.         return $this->statManager->getTopSearchContent();
  67.     }
  68.     public function getMenuTree($id) {
  69.         return $this->cmsTwigManager->getMenuTree($id);
  70.     }
  71.     public function updateDocumentLinks($html) {
  72.         return $this->cmsTwigManager->updateDocumentLinks($html);
  73.     }
  74. }