acf_field_clone::render_field_settings
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_clone{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$acf_field_clone = new acf_field_clone(); $acf_field_clone->render_field_settings( $field );
- $field(обязательный)
- .
Список изменений
| С версии 3.6 | Введена. |
Код acf_field_clone::render_field_settings() acf field clone::render field settings ACF 6.4.2
function render_field_settings( $field ) {
// temp enable 'local' to allow .json fields to be displayed
acf_enable_filter( 'local' );
// default_value
acf_render_field_setting(
$field,
array(
'label' => __( 'Fields', 'acf' ),
'instructions' => __( 'Select one or more fields you wish to clone', 'acf' ),
'type' => 'select',
'name' => 'clone',
'multiple' => 1,
'allow_null' => 1,
'choices' => $this->get_clone_setting_choices( $field['clone'] ),
'ui' => 1,
'ajax' => 1,
'ajax_action' => 'acf/fields/clone/query',
'placeholder' => '',
'nonce' => wp_create_nonce( 'acf/fields/clone/query' ),
)
);
acf_disable_filter( 'local' );
// display
acf_render_field_setting(
$field,
array(
'label' => __( 'Display', 'acf' ),
'instructions' => __( 'Specify the style used to render the clone field', 'acf' ),
'type' => 'select',
'name' => 'display',
'class' => 'setting-display',
'choices' => array(
'group' => __( 'Group (displays selected fields in a group within this field)', 'acf' ),
'seamless' => __( 'Seamless (replaces this field with selected fields)', 'acf' ),
),
)
);
// layout
acf_render_field_setting(
$field,
array(
'label' => __( 'Layout', 'acf' ),
'instructions' => __( 'Specify the style used to render the selected fields', 'acf' ),
'type' => 'radio',
'name' => 'layout',
'layout' => 'horizontal',
'choices' => array(
'block' => __( 'Block', 'acf' ),
'table' => __( 'Table', 'acf' ),
'row' => __( 'Row', 'acf' ),
),
)
);
// prefix_label
$instructions = __( 'Labels will be displayed as %s', 'acf' );
$instructions = sprintf( $instructions, '<code class="prefix-label-code-1"></code>' );
acf_render_field_setting(
$field,
array(
'label' => __( 'Prefix Field Labels', 'acf' ),
'instructions' => $instructions,
'name' => 'prefix_label',
'class' => 'setting-prefix-label',
'type' => 'true_false',
'ui' => 1,
)
);
// prefix_name
$instructions = __( 'Values will be saved as %s', 'acf' );
$instructions = sprintf( $instructions, '<code class="prefix-name-code-1"></code>' );
acf_render_field_setting(
$field,
array(
'label' => __( 'Prefix Field Names', 'acf' ),
'instructions' => $instructions,
'name' => 'prefix_name',
'class' => 'setting-prefix-name',
'type' => 'true_false',
'ui' => 1,
)
);
}