'refresh')); $preview = " data-preview='" . $preview . "'"; $toggle = isset($field['toggle']) ? " data-toggle='" . json_encode($field['toggle']) . "'" : ''; $label_width = isset($field['width']) ? $field['width'] : ''; if (array_key_exists('options', $field)) { $options = $field['options']; foreach ($options as $option_value => $option_label) { $button_options[$option_value] = $option_label; } } else { // Default values for options $button_options['yes'] = __('Yes', 'livemesh-bb-addons'); $button_options['no'] = __('No', 'livemesh-bb-addons'); } $output = "
"; /* Dynamic Styling */ $output .= ''; $count = 1; foreach ($button_options as $field_value => $field_label) { $field_index = 'labb_toggle_' . $count; $output .= $this->get_input_field($name, $value, $field_value, $field_label, $field_index); $count = $count + 1; } $output .= ''; $output .= '
'; echo $output; } function get_input_field($field_name, $chosen_value, $field_value, $field_label, $index) { $checked = ''; if ($chosen_value == $field_value) { $checked = 'checked'; } $html = ''; $html .= ''; return $html; } } new LABB_Toggle_Button(); }