acf_field_time_picker::render_field()publicACF 3.6

Create the HTML interface for your field

Метод класса: acf_field_time_picker{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$acf_field_time_picker = new acf_field_time_picker();
$acf_field_time_picker->render_field( $field );
$field (обязательный)
-

Список изменений

С версии 3.6 Введена.

Код acf_field_time_picker::render_field() ACF 6.0.4

<?php
function render_field( $field ) {

	// Set value.
	$display_value = '';

	if ( $field['value'] ) {
		$display_value = acf_format_date( $field['value'], $field['display_format'] );
	}

	// Elements.
	$div          = array(
		'class'            => 'acf-time-picker acf-input-wrap',
		'data-time_format' => acf_convert_time_to_js( $field['display_format'] ),
	);
	$hidden_input = array(
		'id'    => $field['id'],
		'class' => 'input-alt',
		'type'  => 'hidden',
		'name'  => $field['name'],
		'value' => $field['value'],
	);
	$text_input   = array(
		'class' => $field['class'] . ' input',
		'type'  => 'text',
		'value' => $display_value,
	);
	foreach ( array( 'readonly', 'disabled' ) as $k ) {
		if ( ! empty( $field[ $k ] ) ) {
			$hidden_input[ $k ] = $k;
			$text_input[ $k ]   = $k;
		}
	}

	// Output.
	?>
<div <?php echo acf_esc_attrs( $div ); ?>>
	<?php acf_hidden_input( $hidden_input ); ?>
	<?php acf_text_input( $text_input ); ?>
</div>
	<?php

}