acf_field_time_picker::render_field()publicACF 3.6

Create the HTML interface for your field

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

Хуков нет.

Возвращает

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 5.10.2

<?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' => '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 acf_esc_attr_e( $div ); ?>>
	<?php acf_hidden_input( $hidden_input ); ?>
	<?php acf_text_input( $text_input ); ?>
</div>
	<?php

}