/** * Init view helpers * * @return array */ public function getViewHelperConfig() { return ['invokables' => ['slideshowWidget' => 'Slideshow\\View\\Widget\\SlideshowWidget'], 'factories' => ['slideshowImageUrl' => function () { $imagesDir = ApplicationService::getResourcesUrl() . SlideshowBaseModel::getImagesDir(); return new \Slideshow\View\Helper\SlideshowImageUrl($imagesDir); }]]; }
/** * Get form instance * * @return \Application\Form\ApplicationCustomFormBuilder */ public function getForm() { // get form builder if (!$this->form) { // add preview for the image if ($this->image) { $this->formElements['image']['required'] = false; $this->formElements['image']['extra_options']['preview'] = true; $this->formElements['image']['extra_options']['file_url'] = ApplicationService::getResourcesUrl() . SlideshowBaseModel::getImagesDir() . $this->image; } $this->form = new ApplicationCustomFormBuilder($this->formName, $this->formElements, $this->translator, $this->ignoredElements, $this->notValidatedElements, $this->method); } return $this->form; }