acf_field_true_false::render_field_presentation_settings()publicACF 6.0

Renders the field settings used in the "Presentation" tab.

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

Хуков нет.

Возвращает

null. Ничего.

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

$acf_field_true_false = new acf_field_true_false();
$acf_field_true_false->render_field_presentation_settings( $field );
$field(массив) (обязательный)
The field settings array.

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

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

Код acf_field_true_false::render_field_presentation_settings() ACF 6.0.4

function render_field_presentation_settings( $field ) {
	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'On Text', 'acf' ),
			'instructions' => __( 'Text shown when active', 'acf' ),
			'type'         => 'text',
			'name'         => 'ui_on_text',
			'placeholder'  => __( 'Yes', 'acf' ),
			'conditions'   => array(
				'field'    => 'ui',
				'operator' => '==',
				'value'    => 1,
			),
		)
	);

	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Off Text', 'acf' ),
			'instructions' => __( 'Text shown when inactive', 'acf' ),
			'type'         => 'text',
			'name'         => 'ui_off_text',
			'placeholder'  => __( 'No', 'acf' ),
			'conditions'   => array(
				'field'    => 'ui',
				'operator' => '==',
				'value'    => 1,
			),
		)
	);

	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Stylized UI', 'acf' ),
			'instructions' => __( 'Use a stylized checkbox using select2', 'acf' ),
			'type'         => 'true_false',
			'name'         => 'ui',
			'ui'           => 1,
			'class'        => 'acf-field-object-true-false-ui',
		)
	);
}