public function toggle_switch($var, $values, $label)
{
if (!is_array($values) || $values === array()) {
return;
}
if (!isset($this->options[$var])) {
$this->options[$var] = false;
}
if ($this->options[$var] === true) {
$this->options[$var] = 'on';
}
if ($this->options[$var] === false) {
$this->options[$var] = 'off';
}
$var_esc = esc_attr($var);
echo '<div class="switch-container">';
echo '<fieldset id="', $var_esc, '" class="fieldset-switch-toggle"><legend>', $label, '</legend>
<div class="switch-toggle switch-candy switch-yoast-seo">';
foreach ($values as $key => $value) {
$key_esc = esc_attr($key);
$for = $var_esc . '-' . $key_esc;
echo '<input type="radio" id="' . $for . '" name="' . esc_attr($this->option_name) . '[' . $var_esc . ']" value="' . $key_esc . '" ' . checked($this->options[$var], $key_esc, false) . ' />', '<label for="', $for, '">', $value, '</label>';
}
echo '<a></a></div></fieldset><div class="clear"></div></div>' . "\n\n";
}