acf_field_date_and_time_picker::render_field_settings()publicACF 3.6

Create extra options for your field. This is rendered when editing a field. The value of $field['name'] can be used (like bellow) to save extra data to the $field

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

Хуков нет.

Возвращает

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

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

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

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

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

Код acf_field_date_and_time_picker::render_field_settings() ACF 6.0.4

function render_field_settings( $field ) {
	global $wp_locale;

	$d_m_Y = date_i18n( 'd/m/Y g:i a' );
	$m_d_Y = date_i18n( 'm/d/Y g:i a' );
	$F_j_Y = date_i18n( 'F j, Y g:i a' );
	$Ymd   = date_i18n( 'Y-m-d H:i:s' );

	echo '<div class="acf-field-settings-split">';

	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Display Format', 'acf' ),
			'hint'         => __( 'The format displayed when editing a post', 'acf' ),
			'type'         => 'radio',
			'name'         => 'display_format',
			'other_choice' => 1,
			'choices'      => array(
				'd/m/Y g:i a'  => '<span>' . $d_m_Y . '</span><code>d/m/Y g:i a</code>',
				'm/d/Y g:i a'  => '<span>' . $m_d_Y . '</span><code>m/d/Y g:i a</code>',
				'F j, Y g:i a' => '<span>' . $F_j_Y . '</span><code>F j, Y g:i a</code>',
				'Y-m-d H:i:s'  => '<span>' . $Ymd . '</span><code>Y-m-d H:i:s</code>',
				'other'        => '<span>' . __( 'Custom:', 'acf' ) . '</span>',
			),
		)
	);

	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Return Format', 'acf' ),
			'hint'         => __( 'The format returned via template functions', 'acf' ),
			'type'         => 'radio',
			'name'         => 'return_format',
			'other_choice' => 1,
			'choices'      => array(
				'd/m/Y g:i a'  => '<span>' . $d_m_Y . '</span><code>d/m/Y g:i a</code>',
				'm/d/Y g:i a'  => '<span>' . $m_d_Y . '</span><code>m/d/Y g:i a</code>',
				'F j, Y g:i a' => '<span>' . $F_j_Y . '</span><code>F j, Y g:i a</code>',
				'Y-m-d H:i:s'  => '<span>' . $Ymd . '</span><code>Y-m-d H:i:s</code>',
				'other'        => '<span>' . __( 'Custom:', 'acf' ) . '</span>',
			),
		)
	);

	echo '</div>';

	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Week Starts On', 'acf' ),
			'instructions' => '',
			'type'         => 'select',
			'name'         => 'first_day',
			'choices'      => array_values( $wp_locale->weekday ),
		)
	);
}