acf_field_clone::get_clone_setting_field_choice
This function will return the text for a field choice
Method of the class: acf_field_clone{}
No Hooks.
Returns
(String).
Usage
$acf_field_clone = new acf_field_clone(); $acf_field_clone->get_clone_setting_field_choice( $field );
- $field(required)
- .
Changelog
| Since 5.4.0 | Introduced. |
acf_field_clone::get_clone_setting_field_choice() acf field clone::get clone setting field choice code ACF 6.8.8
function get_clone_setting_field_choice( $field ) {
// bail early if no field
if ( ! $field ) {
return __( 'Unknown field', 'acf' );
}
// title
$title = $field['label'] ? $field['label'] : __( '(no title)', 'acf' );
// append type
$title .= ' (' . $field['type'] . ')';
// ancestors
// - allow for AJAX to send through ancestors count
$ancestors = isset( $field['ancestors'] ) ? $field['ancestors'] : count( acf_get_field_ancestors( $field ) );
$title = str_repeat( '- ', $ancestors ) . $title;
// return
return $title;
}