acf_field_radio::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_radio{}

Хуков нет.

Возвращает

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

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

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

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

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

Код acf_field_radio::render_field_settings() ACF 6.0.4

function render_field_settings( $field ) {
	// Encode choices (convert from array).
	$field['choices'] = acf_encode_choices( $field['choices'] );

	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Choices', 'acf' ),
			'instructions' => __( 'Enter each choice on a new line.', 'acf' ) . '<br />' . __( 'For more control, you may specify both a value and label like this:', 'acf' ) . '<br /><span class="acf-field-setting-example">' . __( 'red : Red', 'acf' ) . '</span>',
			'type'         => 'textarea',
			'name'         => 'choices',
		)
	);

	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Default Value', 'acf' ),
			'instructions' => __( 'Appears when creating a new post', 'acf' ),
			'type'         => 'text',
			'name'         => 'default_value',
		)
	);

	acf_render_field_setting(
		$field,
		array(
			'label'        => __( 'Return Value', 'acf' ),
			'instructions' => __( 'Specify the returned value on front end', 'acf' ),
			'type'         => 'radio',
			'name'         => 'return_format',
			'layout'       => 'horizontal',
			'choices'      => array(
				'value' => __( 'Value', 'acf' ),
				'label' => __( 'Label', 'acf' ),
				'array' => __( 'Both (Array)', 'acf' ),
			),
		)
	);
}