Jump to content

[PS 1.7] Helper Form - multiple switch


Guest

Recommended Posts

Hello.
I need to load and save all features from the database into the form.
I added the is_export column to ps_feature.
0 or 1 will be written to this column.

So how do I put all items in the form?

Thank you

 

$feat = Feature::getFeatures(Configuration::get('PS_LANG_DEFAULT'));
            
        $fields_form[1] = array(
            'form' => array(
                'legend' => array(
                    'title' => $this->l('Enabled Features),
                    'icon' => 'icon-cogs'
                ),

                'input' => array(
   
                    array(
                        'type' => 'switch',
                        'label' => $feat['name'],
                        'name' => $feat['id_feature'],
                        'required' => true,
                        'class' => 't',
                        'is_bool' => true,
                        'values' => array(
                            array(
                                'id' => 'active_on',
                                'value'=> 1,
                                'label'=> $this->l('Enable'),
                            ),
                            array(
                                'id' => 'active_off',
                                'value'=> 0,
                                'label'=> $this->l('Disable'),
                            ),
                        ),
                    ),    
                   
                ),
                'submit' => array(
                    'title' => $this->l('Save settings'),
                    'class' => 'button btn btn-default pull-right',
                )
            ),
            );

 

Edited by Guest (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...