acf_field_true_false::render_field_presentation_settings
Renders the field settings used in the "Presentation" tab.
Method of the class: acf_field_true_false{}
No Hooks.
Returns
null. Nothing (null).
Usage
$acf_field_true_false = new acf_field_true_false(); $acf_field_true_false->render_field_presentation_settings( $field );
- $field(array) (required)
- The field settings array.
Changelog
| Since 6.0 | Introduced. |
acf_field_true_false::render_field_presentation_settings() acf field true false::render field presentation settings code ACF 6.8.8
function render_field_presentation_settings( $field ) {
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,
),
)
);
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,
),
)
);
acf_render_field_setting(
$field,
array(
'label' => __( 'Stylized UI', 'acf' ),
'instructions' => __( 'Use a stylized checkbox using select2', 'acf' ),
'type' => 'true_false',
'name' => 'ui',
'ui' => 1,
'class' => 'acf-field-object-true-false-ui',
)
);
}