public function renderForm() { if (!$this->loadObject(true)) { if (Validate::isLoadedObject($this->object)) { $this->display = 'edit'; } else { $this->display = 'add'; } } $this->initToolbar(); $this->initPageHeaderToolbar(); $id_leoblogcat = (int) Tools::getValue('id_leoblogcat'); $obj = new leoblogcat($id_leoblogcat); // $tree = $obj->getTree(); # validate module $obj->getTree(); $menus = $obj->getDropdown(null, $obj->id_parent); if ($this->object->image) { # validate module $thumb = __PS_BASE_URI__ . 'modules/leoblog/views/img/b/' . $this->object->image; } else { # validate module $thumb = ''; } $this->multiple_fieldsets = true; $this->fields_form[0]['form'] = array('tinymce' => true, 'legend' => array('title' => $this->l('Blog Form'), 'icon' => 'icon-folder-close'), 'input' => array(array('type' => 'select', 'label' => $this->l('Category'), 'name' => 'id_leoblogcat', 'options' => array('query' => $menus, 'id' => 'id', 'name' => 'title'), 'default' => $id_leoblogcat), array('type' => 'text', 'label' => $this->l('Meta title:'), 'name' => 'meta_title', 'id' => 'name', 'lang' => true, 'required' => true, 'class' => 'copyMeta2friendlyURL', 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Friendly URL'), 'name' => 'link_rewrite', 'required' => true, 'lang' => true, 'hint' => $this->l('Only letters and the minus (-) character are allowed')), array('type' => 'tags', 'label' => $this->l('Tags'), 'name' => 'tags', 'lang' => true, 'hint' => array($this->l('Invalid characters:') . ' <>;=#{}', $this->l('To add "tags" click in the field, write something, and then press "Enter."'))), array('type' => 'file', 'label' => $this->l('Image'), 'name' => 'image', 'display_image' => true, 'default' => '', 'desc' => $this->l(''), 'thumb' => $thumb), array('type' => 'textarea', 'label' => $this->l('Video Code'), 'name' => 'video_code', 'rows' => 5, 'cols' => 30, 'hint' => $this->l('Enter Video Code Copying From Youtube, Vimeo') . ' <>;=#{}'), array('type' => 'textarea', 'label' => $this->l('Blog description'), 'name' => 'description', 'autoload_rte' => true, 'lang' => true, 'rows' => 5, 'cols' => 30, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'textarea', 'label' => $this->l('Blog Content'), 'name' => 'content', 'autoload_rte' => true, 'lang' => true, 'rows' => 5, 'cols' => 40, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'switch', 'label' => $this->l('Indexation (by search engines):'), 'name' => 'indexation', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'indexation_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'indexation_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'switch', 'label' => $this->l('Displayed:'), 'name' => 'active', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))))), 'submit' => array('title' => $this->l('Save'), 'class' => 'btn btn-default pull-right')); $this->fields_form[1]['form'] = array('tinymce' => true, 'legend' => array('title' => $this->l('SEO'), 'icon' => 'icon-folder-close'), 'input' => array(array('type' => 'textarea', 'label' => $this->l('Meta description'), 'name' => 'meta_description', 'lang' => true, 'cols' => 40, 'rows' => 10, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'tags', 'label' => $this->l('Meta keywords'), 'name' => 'meta_keywords', 'lang' => true, 'hint' => array($this->l('Invalid characters:') . ' <>;=#{}', $this->l('To add "tags" click in the field, write something, and then press "Enter."'))))); /* if (Shop::isFeatureActive()) { $this->fields_form['input'][] = array( 'type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso', ); } */ $this->tpl_form_vars = array('active' => $this->object->active, 'PS_ALLOW_ACCENTED_CHARS_URL', (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL')); $html = ' <script type="text/javascript"> var PS_ALLOW_ACCENTED_CHARS_URL = ' . (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL') . '; </script> '; return $html . parent::renderForm(); }