Child pages
  • HelperOptions

Versions Compared


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


Removing all the optional fields, this is how to build a basic HelperOptions element:

Code Block
$this->fields_options = array(
    'general' => array(
        'title' => $this->l('Parameters'),
        'fields' => array(
            'PS_MYMODULE_OPTION1' => array(
                'title' => $this->l('Choose one'),
                'desc' => $this->l('Choose between Yes and No.'),
                'cast' => 'boolval',
                'type' => 'bool'
            'PS_MYMODULE_OPTION2' => array(
                'title' => $this->l('Add some text'),
                'desc' => $this->l('This is where you can add some text'),
                'cast' => 'strval',
                'type' => 'text',
                'size' => '10'

This specific code generates this HTML code (simplified here for readability reasons):

Code Block
 <form id="_form" name="_form">

      <labe>Choose one</label>
        <label><img alt="Yes" src="../img/admin/enabled.gif" title="Yes" /></label>
        <input type="radio" value="1" />
        <label><img alt="No" src="../img/admin/disabled.gif" title="No" /></label>
        <input type="radio" value="0" checked="checked" />
        <p>Choose between Yes and No.</p>

    <div class="clear"></div>

      <label>Add some text</label>
        <input type="text" value="" />
        <p>This is where you can add some text</p>