D
D
dumoso2017-02-22 22:08:05
PHP
dumoso, 2017-02-22 22:08:05

Why doesn't PrestaShop show the module config panel correctly?

Why does Presta show my module config ugly, not like other modules?
This is how my module is shown:
xAyCISt.png
This is how others:
O2Z231s.png
The module was made according to the official PrestaShop 1.7 guide.
This is the code responsible for rendering the form

public function displayForm()
  {
    // Get default language
    $default_lang = (int) Configuration::get('PS_LANG_DEFAULT');
    
    // Init Fields form array
    $fields_form[0]['form'] = array(
      'legend' => array(
        'title' => 'Настройки',
        'icon' => 'icon-cogs'
      ),
      'input' => array(
        array(
          'type' => 'text',
          'label' => 'ID',
          'name' => 'WIDGET_ID',
          'required' => true
        )
      ),
      'submit' => array(
        'title' => 'Сохранить',
      )
    );
    
    $helper = new HelperForm();
    
    // Module, token and currentIndex
    $helper->module          = $this;
    $helper->name_controller = $this->name;
    $helper->token           = Tools::getAdminTokenLite('AdminModules');
    $helper->currentIndex    = AdminController::$currentIndex . '&configure=' . $this->name;
    
    // Language
    $helper->default_form_language    = $default_lang;
    $helper->allow_employee_form_lang = $default_lang;
    
    // Title and toolbar
    $helper->title          = $this->displayName;
    $helper->show_toolbar   = true; // false -> remove toolbar
    $helper->toolbar_scroll = true; // yes - > Toolbar is always visible on the top of the screen.
    $helper->submit_action  = 'submit' . $this->name;
    $helper->toolbar_btn    = array(
      'save' => array(
        'desc' => 'Сохранить',
        'href' => AdminController::$currentIndex . '&configure=' . $this->name . '&save' . $this->name . '&token=' . Tools::getAdminTokenLite('AdminModules')
      ),
      'back' => array(
        'href' => AdminController::$currentIndex . '&token=' . Tools::getAdminTokenLite('AdminModules'),
        'desc' => 'Вернуться к списку'
      )
    );
    
    // Load current value
    $helper->fields_value['WIDGET_ID'] = Configuration::get('WIDGET_ID');
    
    return $helper->generateForm($fields_form);
  }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question