acf_field_file::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
{} Это метод класса: acf_field_file{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$acf_field_file = new acf_field_file(); $acf_field_file->render_field_settings( $field );
- an($field -) (обязательный)
- array holding all the field's data
Список изменений
С версии 3.6 | Введена. |
Код acf_field_file::render_field_settings() acf field file::render field settings ACF 5.9.1
function render_field_settings( $field ) {
// clear numeric settings
$clear = array(
'min_size',
'max_size'
);
foreach( $clear as $k ) {
if( empty($field[$k]) ) {
$field[$k] = '';
}
}
// 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(
'array' => __("File Array",'acf'),
'url' => __("File URL",'acf'),
'id' => __("File ID",'acf')
)
));
// library
acf_render_field_setting( $field, array(
'label' => __('Library','acf'),
'instructions' => __('Limit the media library choice','acf'),
'type' => 'radio',
'name' => 'library',
'layout' => 'horizontal',
'choices' => array(
'all' => __('All', 'acf'),
'uploadedTo' => __('Uploaded to post', 'acf')
)
));
// min
acf_render_field_setting( $field, array(
'label' => __('Minimum','acf'),
'instructions' => __('Restrict which files can be uploaded','acf'),
'type' => 'text',
'name' => 'min_size',
'prepend' => __('File size', 'acf'),
'append' => 'MB',
));
// max
acf_render_field_setting( $field, array(
'label' => __('Maximum','acf'),
'instructions' => __('Restrict which files can be uploaded','acf'),
'type' => 'text',
'name' => 'max_size',
'prepend' => __('File size', 'acf'),
'append' => 'MB',
));
// allowed type
acf_render_field_setting( $field, array(
'label' => __('Allowed file types','acf'),
'instructions' => __('Comma separated list. Leave blank for all types','acf'),
'type' => 'text',
'name' => 'mime_types',
));
}