/** * Load post data to the template. * * @param PostInterface $post */ public function load(PostInterface $post) { $this->template->set('title', $post->getTitle()); $this->template->set('meta_title', $post->metaTitle()); $this->template->set('meta_keywords', $post->metaKeywords()); $this->template->set('meta_description', $post->metaDescription()); }
/** * Handle the command. */ public function handle(ViewTemplate $template) { /* @var PageInterface $page */ if (!($page = $template->get('page'))) { return; } /* @var PageInterface $current */ $current = $this->pages->find($page->getId()); $current->setCurrent(true); }
/** * Handle the event. */ public function handle() { if (in_array($this->request->path(), ['admin/logout'])) { return; } if ($this->request->segment(1) !== 'admin') { return; } $this->template->put('cp', $this->controlPanel->build()); }
/** * Preview a page. * * @param ViewTemplate $template * @param PageRepositoryInterface $pages * @param $id * @return null|\Symfony\Component\HttpFoundation\Response */ public function preview(ViewTemplate $template, PageRepositoryInterface $pages, $id) { if (!($page = $pages->findByStrId($id))) { abort(404); } $page->setAttribute('enabled', true); $type = $page->getType(); $handler = $type->getHandler(); $template->set('page', $page); $handler->make($page); return $page->getResponse(); }
/** * Handle the event. * * @param ViewComposed $event */ public function handle(ViewComposed $event) { $view = $event->getView(); if (array_get($view->getData(), 'template')) { return; } if (!$this->template->isLoaded()) { $this->events->fire(new RegisteringTwigPlugins($this->twig)); $this->events->fire(new TemplateDataIsLoading($this->template)); $this->template->setLoaded(true); } if (array_merge($view->getFactory()->getShared(), $view->getData())) { $view['template'] = (new Decorator())->decorate($this->template); } }
/** * Handle the command. * * @param Container $container * @param ViewTemplate $template * @param BreadcrumbCollection $breadcrumbs */ public function handle(Container $container, ViewTemplate $template, BreadcrumbCollection $breadcrumbs) { $tree = $this->builder->getTree(); $tree->addData('tree', $tree); if ($handler = $tree->getOption('data')) { $container->call($handler, compact('tree')); } if ($layout = $tree->getOption('layout_view')) { $template->put('layout', $layout); } if ($title = $tree->getOption('title')) { $template->put('title', $title); } if ($breadcrumb = $tree->getOption('breadcrumb')) { $breadcrumbs->put($breadcrumb, '#'); } }
/** * Handle the command. * * @param PageRepositoryInterface $pages * @param ViewTemplate $template * @return PageInterface|EloquentModel|null */ public function handle(PageRepositoryInterface $pages, ViewTemplate $template) { if (is_null($this->identifier)) { $this->identifier = $template->get('page'); } if (is_numeric($this->identifier)) { return $pages->find($this->identifier); } if (is_string($this->identifier)) { return $pages->findByPath($this->identifier); } if ($this->identifier instanceof PageInterface) { return $this->identifier; } if ($this->identifier instanceof PagePresenter) { return $this->identifier->getObject(); } return null; }
/** * Handle the command. * * @param Container $container * @param ViewTemplate $template * @param BreadcrumbCollection $breadcrumbs */ public function handle(Container $container, ViewTemplate $template, BreadcrumbCollection $breadcrumbs) { $form = $this->builder->getForm(); if ($handler = $form->getOption('data')) { $container->call($handler, compact('form')); } if ($layout = $form->getOption('layout_view')) { $template->put('layout', $layout); } if ($title = $form->getOption('title')) { $template->put('title', $title); } // Move this to options so we can read it. $this->builder->setFormOption('read_only', $this->builder->isReadOnly()); $form->addData('form', $form); if ($breadcrumb = $form->getOption('breadcrumb', 'streams::form.mode.' . $this->builder->getFormMode())) { $breadcrumbs->put($breadcrumb, '#'); } }
/** * Handle the event. */ public function handle() { $this->template->set('messages', $this->messages); }
/** * Handle the event. */ public function handle() { $this->template->set('breadcrumbs', $this->breadcrumbs); }
/** * Set the meta title. * * @param ViewTemplate $template */ public function handle(ViewTemplate $template) { $template->set('meta_title', trans('anomaly.module.posts::addon.name')); }
/** * Handle the command. * * @param ViewTemplate $template */ public function handle(ViewTemplate $template) { $template->set('meta_title', $this->type->getName()); }
/** * Set the meta title. * * @param ViewTemplate $template */ public function handle(ViewTemplate $template) { $template->set('meta_title', trans('anomaly.module.posts::breadcrumb.posts')); }
/** * Handle the command. * * @param ViewTemplate $template */ public function handle(ViewTemplate $template) { $template->set('meta_title', trans('anomaly.module.posts::breadcrumb.tagged', ['tag' => $this->tag])); }