/** * Display a group of radio buttons * * @param array $setting See `do_settings_field()`. Has been filtered through `RO3::get_field_array()` * @return null * @since 1.0.0 */ public static function radio_field($setting) { extract($setting); $choices = RO3::get_choice_array($setting); foreach ($choices as $choice) { $label = $choice['label']; $value = $choice['value']; ?> <label class='radio' for="<?php echo $choice['id']; ?> "> <input type="radio" id="<?php echo $choice['id']; ?> " name="ro3_options[<?php echo $name; ?> ]" value="<?php echo $value; ?> " class="<?php if (array_key_exists('class', $setting)) { echo $setting['class']; } ?> " <?php # add data attributes if (array_key_exists('data', $choice)) { foreach ($choice['data'] as $k => $v) { echo " data-{$k}='{$v}'"; } } # add checked property if we need to if (isset(self::$options[$name])) { checked($value, self::$options[$name]); } ?> autocomplete='off' /> <?php echo $label; ?> </label> <?php } }