acf_field_select::render_field_settings
Renders the field settings used in the "General" tab.
Метод класса: acf_field_select{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$acf_field_select = new acf_field_select(); $acf_field_select->render_field_settings( $field );
- $field(массив) (обязательный)
- An array holding all the field's data.
Список изменений
| С версии 3.6 | Введена. |
Код acf_field_select::render_field_settings() acf field select::render field settings ACF 6.4.2
public function render_field_settings( $field ) {
// encode choices (convert from array)
$field['choices'] = acf_encode_choices( $field['choices'] );
$field['default_value'] = acf_encode_choices( $field['default_value'], false );
// 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>',
'name' => 'choices',
'type' => 'textarea',
)
);
// default_value
acf_render_field_setting(
$field,
array(
'label' => __( 'Default Value', 'acf' ),
'instructions' => __( 'Enter each default value on a new line', 'acf' ),
'name' => 'default_value',
'type' => 'textarea',
)
);
// return_format
acf_render_field_setting(
$field,
array(
'label' => __( 'Return Format', 'acf' ),
'instructions' => __( 'Specify the value returned', 'acf' ),
'type' => 'radio',
'name' => 'return_format',
'layout' => 'horizontal',
'choices' => array(
'value' => __( 'Value', 'acf' ),
'label' => __( 'Label', 'acf' ),
'array' => __( 'Both (Array)', 'acf' ),
),
)
);
acf_render_field_setting(
$field,
array(
'label' => __( 'Select Multiple', 'acf' ),
'instructions' => 'Allow content editors to select multiple values',
'name' => 'multiple',
'type' => 'true_false',
'ui' => 1,
)
);
}