/**
  * @param array $data
  */
 public function addTwitterCard(array $data = [])
 {
     if ($this->twitterCard) {
         foreach ($data as $key => $value) {
             $this->clientView->addHeadString('<meta property="twitter:' . $key . '" content="' . $value . '"/>', 'twitter_' . $key . '');
         }
     }
 }
 /**
  * {@inheritdoc}
  *
  * @return ClientView
  */
 public function render(Request $request)
 {
     $actor = $request->getAttribute('actor');
     $assets = $this->getAssets();
     $locale = $this->locales->getLocale();
     $localeCompiler = $locale ? $this->getLocaleCompiler($locale) : null;
     $view = new ClientView($this->api, $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->events->fire(new ConfigureClientView($this, $view, $keys));
     if ($localeCompiler) {
         $translations = array_get($this->locales->getTranslator()->getMessages(), 'messages', []);
         $translations = $this->filterTranslations($translations, $keys);
         $localeCompiler->setTranslations($translations);
     }
     app('view')->share('translator', $this->locales->getTranslator());
     return $view;
 }
Пример #3
0
 public function addBootstrapper($bootstrapper)
 {
     $this->view->addBootstrapper($bootstrapper);
 }
Пример #4
0
 /**
  * {@inheritdoc}
  *
  * @return ClientView
  */
 public function render(Request $request)
 {
     $actor = $request->getAttribute('actor');
     $assets = $this->getAssets();
     $locale = $this->locales->getLocale();
     $localeCompiler = $locale ? $this->getLocaleCompiler($locale) : null;
     $view = new ClientView($this->api, $request, $actor, $assets, $this->layout, $localeCompiler);
     $view->setVariable('locales', $this->locales->getLocales());
     $view->setVariable('locale', $locale);
     $this->events->fire(new ConfigureClientView($this, $view));
     if ($localeCompiler) {
         $translations = array_get($this->locales->getTranslator()->getMessages(), 'messages', []);
         $translations = $this->filterTranslations($translations);
         $localeCompiler->setTranslations($translations);
     }
     app('view')->share('translator', $this->locales->getTranslator());
     return $view;
 }