Child pages
  • HelperOptions

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of contents

Table of Contents

HelperOptions

This helper is used to generate a configuration form, the values of which are stored in the configuration table. Example: the "Preferences" page.

Options declaration

Fields inside [brackets] are optional.
Values between {curly braces} list the possible values for this field.

Code Block
$this->fields_options = array(
        'general' => array(
            ['title'] => $this->l('Carrier options'),                          // ifIf missing, default is 'Options'.
            ['top'] => $this->l('Text to display before the fieldset'),
            ['image'] => 'url to icon',                                         // ifIf missing will use the default icon for the tab.
            ['description'] => $this->l('Display as description'),
            ['info'] => $this->l('Display as info'),
            'fields' => array(
                'PS_CARRIER_DEFAULT' => array(
                    ['title'] => $this->l('Default carrier:'),
                    ['desc'] => $this->l('The default carrier used in shop'),
                    ['cast'] => 'intval', 
                   'type' => {'text', 'hidden', 'select', 'bool', 'radio', 
          'checkbox', 'password', 'textarea', 'file', 'textLang', 'textareaLang',
'selectLang'},          'textareaLang', 'selectLang'},
         ['suffix'] => 'Display after the field (ie. currency)',     // onlyOnly for text or password.
                    'identifier' => 'id_carrier',
                    ['list'] => array(list do display as options),             // onlyOnly for select.
                    ['empty_message'] => $this->l('Display if list is empty'), // onlyOnly for select.
                    ['cols'] => 40,                                            // forFor textarea.
                    ['rows'] => 5,                                             // forFor textarea.
                    ['thumb'] => 'url to thumb image',                          // forFor files.
                    ),
                    ['is_invisible'] => {true, false}                          // Disable the field depending on shop context.
                ),
                'ANOTHER_FIELD' => ...array(
        ...
   ),   ),
    ),
    'submit' => array()
        ),
        'another fieldset' => ...
    );