<?php
/**
 *
 *
 * @var int    $form_id         Which form we are dealing with.
 * @var int    $field_id        Which field ID we are dealing with.
 * @var string $html_id         Which field html this field has.
 * @var array  $field           Which field object we are dealing with.
 * @var array  $entries         Which entries we are modifying.
 * @var array  $selected_fields Which fields were selected.
 * @var string $view            Which view are in.
 * @var string $placeholder     Place holder for this field.
 * @var mixed  $form            Form settings.
 */

$id      = isset( $input['id'] ) ? $input['id'] : $field->id;
$choices = isset( $input['choices'] ) ? $input['choices'] : $field->choices;
?>

<?php
$i = 0;
foreach ( $choices as $choice ) {
	$i ++;
?>
	<div>
		<?php
		$value   = ! empty( $field_values[ $id ] ) ? $field_values[ $id ] : null;
		$html_id .= '-' . $choice->value;
		?>
		<input
			id="<?php echo sanitize_html_class( $html_id ); ?>"
			type="radio"
			class="gk-gravityactions-email-field"
			name="field_values[<?php echo esc_attr( $id ); ?>]"
			<?php checked( $value === $choice->value || ( ! $value && $i === 1 ) ); ?>
			value="<?php echo esc_attr( $choice->value ); ?>"
		/>
		<label for="<?php echo $html_id; ?>">
			<?php echo esc_html( $choice->text ); ?>
		</label>
	</div>
<?php } ?>
