Example #1
0
 public function getFormHelper()
 {
     $default_lang = (int) Configuration::get('PS_LANG_DEFAULT');
     $styles = PsPagebuilderHelper::detectWidgetClasses();
     $this->fields_form[0]['form'] = array('legend' => array('title' => $this->l('Widget Info.')), 'input' => array(array('type' => 'hidden', 'label' => $this->l('Widget Key'), 'name' => 'wkey', 'default' => Tools::getValue('wkey'), 'desc' => $this->l('Using for show in Listing Widget Management')), array('type' => 'hidden', 'label' => $this->l('Widget Type'), 'name' => 'wtype', 'default' => $this->name, 'desc' => $this->l('Using for show in Listing Widget Management')), array('type' => 'text', 'label' => $this->l('Widget Name'), 'name' => 'widget_name', 'default' => '', 'desc' => $this->l('Using for show in Listing Widget Management')), array('type' => 'switch', 'label' => $this->l('Display Title'), 'desc' => $this->l('Show the title on the widget block'), 'name' => 'show_title', 'default' => 1, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'text', 'label' => $this->l('Widget Title'), 'name' => 'widget_title', 'default' => '', 'lang' => true, 'desc' => $this->l('This tile will be showed as header of widget block. Empty to disable')), array('type' => 'text', 'label' => $this->l('Addition Class'), 'name' => 'addition_cls', 'default' => '', 'desc' => $this->l('This class is used to make owner style for the widget.')), array('type' => 'select', 'label' => $this->l('Widget Box Style'), 'name' => 'stylecls', 'options' => array('query' => $styles['widget'], 'id' => 'class', 'name' => 'name'), 'default' => '', 'desc' => $this->l('These classes are automatic loaded in file pagebuider.css in module or actived theme'))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
     //d($styles);
     $helper = new HelperForm();
     $helper->module = new $this->mod_name();
     $helper->name_controller = $this->mod_name;
     $helper->identifier = $this->mod_name;
     $helper->token = Tools::getAdminTokenLite('AdminModules');
     foreach (Language::getLanguages(false) as $lang) {
         $helper->languages[] = array('id_lang' => $lang['id_lang'], 'iso_code' => $lang['iso_code'], 'name' => $lang['name'], 'is_default' => $default_lang == $lang['id_lang'] ? 1 : 0);
     }
     $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->mod_name . '&widgets=1&rand=' . rand() . '&wtype=' . Tools::getValue('wtype');
     $helper->default_form_language = $default_lang;
     $helper->allow_employee_form_lang = $default_lang;
     $helper->toolbar_scroll = true;
     $helper->title = $this->mod_name;
     $helper->submit_action = 'save' . $this->mod_name;
     $helper->toolbar_btn = array('back' => array('desc' => $this->l('Back'), 'href' => AdminController::$currentIndex . '&configure=' . $this->mod_name . '&save' . $this->mod_name . '&token=' . Tools::getAdminTokenLite('AdminModules') . '&widgets=1&rand=' . rand()));
     return $helper;
 }