示例#1
0
 public function adminBootstrapper($bootstrapper)
 {
     if ($this->action instanceof AdminClientAction) {
         $this->view->addBootstrapper($bootstrapper);
     }
 }
示例#2
0
 /**
  * {@inheritdoc}
  *
  * @return ClientView
  */
 public function render(Request $request, array $routeParams = [])
 {
     $actor = app('flarum.actor');
     $assets = $this->getAssets();
     $locale = $this->getLocale($actor, $request);
     $localeCompiler = $locale ? $this->getLocaleCompiler($locale) : null;
     $view = new ClientView($this->apiClient, $request, $actor, $assets, $this->layout, $localeCompiler);
     $view->setVariable('locales', $this->locales->getLocales());
     $view->setVariable('locale', $locale);
     // Now that we've set up the ClientView instance, we can fire an event
     // to give extensions the opportunity to add their own assets and
     // translations. We will pass an array to the event which specifies
     // which translations should be included in the locale file. Afterwards,
     // we will filter all of the translations for the actor's locale and
     // compile only the ones we need.
     $keys = $this->translationKeys;
     $this->fireEvent($view, $keys);
     if ($localeCompiler) {
         $translations = $this->locales->getTranslations($locale);
         $translations = $this->filterTranslations($translations, $keys);
         $localeCompiler->setTranslations($translations);
     }
     return $view;
 }
示例#3
0
 public function addBootstrapper($bootstrapper)
 {
     $this->view->addBootstrapper($bootstrapper);
 }