acf_field_relationship::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_relationship{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$acf_field_relationship = new acf_field_relationship(); $acf_field_relationship->render_field_settings( $field );
- an($field -) (обязательный)
- array holding all the field's data
Список изменений
С версии 3.6 | Введена. |
Код acf_field_relationship::render_field_settings() acf field relationship::render field settings ACF 5.9.1
function render_field_settings( $field ) {
// vars
$field['min'] = empty($field['min']) ? '' : $field['min'];
$field['max'] = empty($field['max']) ? '' : $field['max'];
// post_type
acf_render_field_setting( $field, array(
'label' => __('Filter by Post Type','acf'),
'instructions' => '',
'type' => 'select',
'name' => 'post_type',
'choices' => acf_get_pretty_post_types(),
'multiple' => 1,
'ui' => 1,
'allow_null' => 1,
'placeholder' => __("All post types",'acf'),
));
// taxonomy
acf_render_field_setting( $field, array(
'label' => __('Filter by Taxonomy','acf'),
'instructions' => '',
'type' => 'select',
'name' => 'taxonomy',
'choices' => acf_get_taxonomy_terms(),
'multiple' => 1,
'ui' => 1,
'allow_null' => 1,
'placeholder' => __("All taxonomies",'acf'),
));
// filters
acf_render_field_setting( $field, array(
'label' => __('Filters','acf'),
'instructions' => '',
'type' => 'checkbox',
'name' => 'filters',
'choices' => array(
'search' => __("Search",'acf'),
'post_type' => __("Post Type",'acf'),
'taxonomy' => __("Taxonomy",'acf'),
),
));
// filters
acf_render_field_setting( $field, array(
'label' => __('Elements','acf'),
'instructions' => __('Selected elements will be displayed in each result','acf'),
'type' => 'checkbox',
'name' => 'elements',
'choices' => array(
'featured_image' => __("Featured Image",'acf'),
),
));
// min
acf_render_field_setting( $field, array(
'label' => __('Minimum posts','acf'),
'instructions' => '',
'type' => 'number',
'name' => 'min',
));
// max
acf_render_field_setting( $field, array(
'label' => __('Maximum posts','acf'),
'instructions' => '',
'type' => 'number',
'name' => 'max',
));
// return_format
acf_render_field_setting( $field, array(
'label' => __('Return Format','acf'),
'instructions' => '',
'type' => 'radio',
'name' => 'return_format',
'choices' => array(
'object' => __("Post Object",'acf'),
'id' => __("Post ID",'acf'),
),
'layout' => 'horizontal',
));
}