addElement('hidden', 'submitAndManage', ['value' => '0']); $this->addElement('text', 'title', ['label' => 'Title', 'required' => true]); $this->addSeoGroup('Gallery'); $config = $this->getConfig('image'); $resize = $config->width . 'x' . $config->height . Qs_ImageFs::getResizeMethodAlias($config->method); $this->addElement('extendedImage', 'image', ['label' => 'Image', 'resize' => $resize]); $this->addElement( 'htmlEditor', 'description', [ 'label' => 'Description', 'hasMsWordNote' => true, 'toolbar' => 'Basic' ] ); $this->addElement('checkbox', 'enabled', ['label' => 'Show on user end', 'decoration' => 'simple']); return $this; } protected function _initButtons() { if (!$this->_hasButtons) { return $this; } $buttons = []; $this->addElement( 'submit', 'btnSubmit', [ 'label' => 'Save', 'attribs' => ['class' => 'btn btn-primary'], 'onclick' => '$("#submitAndManage").val("0");' ] ); $buttons[] = 'btnSubmit'; if ($this->_managePhotosButtonTitle) { $this->addElement( 'submit', 'btnSubmitManage', [ 'label' => $this->_managePhotosButtonTitle, 'attribs' => ['class' => 'btn btn-primary'], 'onclick' => '$("#submitAndManage").val("1");' ] ); $buttons[] = 'btnSubmitManage'; } $this->addElement( 'submit', 'btnCancel', [ 'label' => 'Cancel', 'attribs' => [ 'class' => 'btn', 'onclick' => "window.location.href = '" . htmlspecialchars($this->getCancelUrl()) . "';", 'helper' => 'formInputButton', ], ] ); $buttons[] = 'btnCancel'; $this->addDisplayGroup($buttons, 'submitGroup'); return $this; } }