<?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;
$value = ! empty( $field_values[ $id ] ) ? $field_values[ $id ] : null;

if ( $value ) {
	$datetime = new DateTime( $value );
	$formatted = $datetime->format( 'Y-m-d\TH:S' );
}
?>
<input
	id="<?php echo esc_attr( $html_id ); ?>"
	type="datetime-local"
	class="gk-gravityactions-edit-field"
	name="field_values[<?php echo esc_attr( $id ); ?>]"
	<?php if ( ! empty( $placeholder ) ) : ?>
		placeholder="<?php echo esc_attr( $placeholder ); ?>"
	<?php endif; ?>
	<?php if ( $value ) : ?>
		value="<?php echo esc_attr( stripslashes_deep( $value ) ); ?>"
	<?php endif; ?>
/>
