acf_field_true_false::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_true_false{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$acf_field_true_false = new acf_field_true_false(); $acf_field_true_false->render_field_settings( $field );
- an($field -) (обязательный)
- array holding all the field's data
Список изменений
С версии 3.6 | Введена. |
Код acf_field_true_false::render_field_settings() acf field true false::render field settings ACF 5.9.1
function render_field_settings( $field ) {
// message
acf_render_field_setting( $field, array(
'label' => __('Message','acf'),
'instructions' => __('Displays text alongside the checkbox','acf'),
'type' => 'text',
'name' => 'message',
));
// default_value
acf_render_field_setting( $field, array(
'label' => __('Default Value','acf'),
'instructions' => '',
'type' => 'true_false',
'name' => 'default_value',
));
// ui
acf_render_field_setting( $field, array(
'label' => __('Stylised UI','acf'),
'instructions' => '',
'type' => 'true_false',
'name' => 'ui',
'ui' => 1,
'class' => 'acf-field-object-true-false-ui'
));
// on_text
acf_render_field_setting( $field, array(
'label' => __('On Text','acf'),
'instructions' => __('Text shown when active','acf'),
'type' => 'text',
'name' => 'ui_on_text',
'placeholder' => __('Yes', 'acf'),
'conditions' => array(
'field' => 'ui',
'operator' => '==',
'value' => 1
)
));
// on_text
acf_render_field_setting( $field, array(
'label' => __('Off Text','acf'),
'instructions' => __('Text shown when inactive','acf'),
'type' => 'text',
'name' => 'ui_off_text',
'placeholder' => __('No', 'acf'),
'conditions' => array(
'field' => 'ui',
'operator' => '==',
'value' => 1
)
));
}