/** * Builds an instance of a simple template * @param $entry Entry for the template * @return ViewCollection the build template */ private function buildSimpleTemplate($entry) { $collection = new ViewCollection($this->lifeCycle, "front_end-entry"); $collection->setTemplateVar("title", $entry->title); $collection->setTemplateVar("top_content", $entry->top_content); $collection->setTemplateVar("bottom_content", $entry->bottom_content); if (count($entry->getChildren())) { $collection->addChildViews("children", $this->buildCollections($entry->getChildren())); } return $collection; }
/** * @param $atts shortcode inputs * @return string shortcode content */ public function handleShortcode($atts) { $exportedContent = ''; $slider = Slider::find_one($atts['id']); if ($slider) { $slider->loadImages(); $slider->prepareExport(); if ($slider->popup_only) { $exportedContent .= $this->loadMagnificAssets(); $template = new MustacheTemplate($this->lifeCycle, "popup_link", $slider); $exportedContent .= $template->export(); } else { $css = new CSS($this->lifeCycle, "jquery.bxslider"); $css->setTemplateVar("plugin_directory", plugin_dir_url(__DIR__ . "../")); $exportedContent .= $css->export(); $images = $slider->getImages(); $sliderView = new ViewCollection($this->lifeCycle, "slider"); $sliderView->setTemplateVar("title", $slider->name); $sliderView->setTemplateVar("subtitle", $slider->description); $sliderView->setTemplateVar("id", $slider->id); $sliderView = $this->buildCollection($sliderView, $images); $exportedContent .= $sliderView->export(); $js = new JavaScript($this->lifeCycle, "jquery.bxslider"); $exportedContent .= $js->export(); $js = new JavaScript($this->lifeCycle, "plugin"); $js->setTemplateVar('id', $slider->id); $js->setTemplateVar('auto_play', $slider->auto_play ? 'true' : 'false'); $js->setTemplateVar('fluid_touch', $slider->fluid_touch ? 'true' : 'false'); $js->setTemplateVar('pager', $slider->pager ? 'true' : 'false'); $js->setTemplateVar('auto_play_speed', $slider->auto_play_pause_speed); $js->setTemplateVar("start_slide", $slider->start_slide); if ($slider->light_box) { $exportedContent .= $this->buildLightBox($slider); } $exportedContent .= $js->export(); } } return $exportedContent; }