/** * Init view helpers * * @return array */ public function getViewHelperConfig() { return ['invokables' => ['miniPhotoGalleryWidget' => 'MiniPhotoGallery\\View\\Widget\\MiniPhotoGalleryWidget'], 'factories' => ['miniPhotoGalleryImageUrl' => function () { $thumbDir = ApplicationService::getResourcesUrl() . MiniPhotoGalleryBaseModel::getThumbnailsDir(); $imageDir = ApplicationService::getResourcesUrl() . MiniPhotoGalleryBaseModel::getImagesDir(); return new \MiniPhotoGallery\View\Helper\MiniPhotoGalleryImageUrl($thumbDir, $imageDir); }]]; }
/** * 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() . MiniPhotoGalleryBaseModel::getThumbnailsDir() . $this->image; } $this->form = new ApplicationCustomFormBuilder($this->formName, $this->formElements, $this->translator, $this->ignoredElements, $this->notValidatedElements, $this->method); } return $this->form; }