acf_field_radio::render_field_settings() │ public │ ACF 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_radio{}
Хуков нет.
Возвращает
null
. Ничего.
Использование
$acf_field_radio = new acf_field_radio();
$acf_field_radio->render_field_settings( $field );
- $field (обязательный)
- -
Список изменений
Код acf_field_radio::render_field_settings() acf field radio::render field settings
ACF 5.10.2
function render_field_settings( $field ) {
// encode choices (convert from array)
$field['choices'] = acf_encode_choices( $field['choices'] );
// choices
acf_render_field_setting(
$field,
array(
'label' => __( 'Choices', 'acf' ),
'instructions' => __( 'Enter each choice on a new line.', 'acf' ) . '<br /><br />' . __( 'For more control, you may specify both a value and label like this:', 'acf' ) . '<br /><br />' . __( 'red : Red', 'acf' ),
'type' => 'textarea',
'name' => 'choices',
)
);
// allow_null
acf_render_field_setting(
$field,
array(
'label' => __( 'Allow Null?', 'acf' ),
'instructions' => '',
'name' => 'allow_null',
'type' => 'true_false',
'ui' => 1,
)
);
// other_choice
acf_render_field_setting(
$field,
array(
'label' => __( 'Other', 'acf' ),
'instructions' => '',
'name' => 'other_choice',
'type' => 'true_false',
'ui' => 1,
'message' => __( "Add 'other' choice to allow for custom values", 'acf' ),
)
);
// save_other_choice
acf_render_field_setting(
$field,
array(
'label' => __( 'Save Other', 'acf' ),
'instructions' => '',
'name' => 'save_other_choice',
'type' => 'true_false',
'ui' => 1,
'message' => __( "Save 'other' values to the field's choices", 'acf' ),
'conditions' => array(
'field' => 'other_choice',
'operator' => '==',
'value' => 1,
),
)
);
// default_value
acf_render_field_setting(
$field,
array(
'label' => __( 'Default Value', 'acf' ),
'instructions' => __( 'Appears when creating a new post', 'acf' ),
'type' => 'text',
'name' => 'default_value',
)
);
// layout
acf_render_field_setting(
$field,
array(
'label' => __( 'Layout', 'acf' ),
'instructions' => '',
'type' => 'radio',
'name' => 'layout',
'layout' => 'horizontal',
'choices' => array(
'vertical' => __( 'Vertical', 'acf' ),
'horizontal' => __( 'Horizontal', 'acf' ),
),
)
);
// return_format
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' ),
),
)
);
}