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

@type action

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

Хуков нет.

Возвращает

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 5.10.2

function render_field_settings( $field ) {

	// global
	global $wp_locale;

	// vars
	$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' );

	// display_format
	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Display Format', 'acf' ),
			'instructions' => __( '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>',
			),
		)
	);

	// return_format
	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Return Format', 'acf' ),
			'instructions' => __( '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>',
			),
		)
	);

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

}