In the plugin settings, whenever I add input type="text", I can save any values in an array just fine. I save the settings and the values stay there.
But checkboxes always reset because I can't seem to save checkbox values in arrays like text values.
Here's the array where I save the values for input fields.
Code: Select all
public function init() {
$this->dbFields = array(
'cars' => '', //text
'bikes' => '' //checkbox
);
}
Code: Select all
// Cars - text
$html .= '<div>';
$html .= '<input name="cars" type="text" class="form-control" value="'.$this->getValue('cars').'">';
$html .= '</div>'.PHP_EOL;
// Bikes - checkbox
$html .= '<div>';
$html .= '<input name="bikes" type="text" class="form-control" value="'.$this->getValue('bikes').'">';
$html .= '</div>'.PHP_EOL;
Thank you!