Child pages
  • HelperForm
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

HelperForm

Form declaration

Fields inside [brackets] are optional.

$this->fields_form = array(    
  'legend' => array(        
    'title' => $this->l('Edit carrier'),        
    'image' => '../img/admin/icon_to_display.gif'    
  ),    
  'input' => array(        
    array(            
      'type' => {'text', 'select', 'textarea', 'radio', 'checkbox', 'file', 'shop', 'asso_shop', 'free', 'color'},
      ['label'] => $this->l('Shipping method'),
      'name' => 'shipping_method',                           // name of the object property from which we get the value
      ['required'] => {true, false},
      ['desc'] => $this->l('Description displayed under the field'),
      ['hint'] => $this->l('Invalid characters:').' <>;=#{}' // displayed on hover
      ['suffix'] => 'kg'                                     // displayed after the field (for ex. unit of measure)
      ['options'] => array(                                  // only if type == select
        'query' => $array_of_rows,
        'id' => 'id_carrier',                                // key that will be used for each option "value" attribute
      ),
      ['values'] => array(                                   // only if type == radio
        array(
          'id' => 'active_on',
          'value' => 1,
          'label' => $this->l('Enabled')
        ),
        array(
          'id' => 'active_off',
          'value' => 0,
          'label' => $this->l('Disabled')
        )
      ),
      [is_bool] => {true, false},                            // only if type == radio, display as yes or no choice
      ['empty_message'] => $this->l('To be displayed when the field is empty'),
      ['lang'] => {true, false},                             // is the field multilang?
     ),
    array(          
      //another field      
    ),    
  ),
  'submit' => array(
    'title' => $this->l('   Save   '),        
    'class' => 'button'    
  )
);

If you want to use the "color" type, you can add the "color mColorPickerInput" class

  • No labels