public static function toggleButton($action, $select_name, $options, $callback)
{
// Do the logic first
$link = "{$action}&" . urlencode($select_name) . "=";
$link_on = $link . urlencode($options[1]['value']);
$link_off = $link . urlencode($options[0]['value']);
if ($options[1]['selected'] == true) {
$state = 'on';
} else {
if ($options[0]['selected'] == true) {
$state = 'off';
} else {
$state = 'on';
}
}
return Template::get('toggle_button')->render(['pmaThemeImage' => $GLOBALS['pmaThemeImage'], 'text_dir' => $GLOBALS['text_dir'], 'link_on' => $link_on, 'toggleOn' => str_replace(' ', ' ', htmlspecialchars($options[1]['label'])), 'toggleOff' => str_replace(' ', ' ', htmlspecialchars($options[0]['label'])), 'link_off' => $link_off, 'callback' => $callback, 'state' => $state]);
}