acf_field_clone::get_clone_setting_choicepublicACF 5.3.8

This function will return the label for a given clone 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_choice( $selector );
$selector
.
Default: ''

Changelog

Since 5.3.8 Introduced.

acf_field_clone::get_clone_setting_choice() code ACF 6.8.8

function get_clone_setting_choice( $selector = '' ) {

	// bail early no selector
	if ( ! $selector ) {
		return '';
	}

	// phpcs:disable WordPress.Security.NonceVerification.Missing -- Verified elsewhere.
	// ajax_fields
	if ( isset( $_POST['fields'][ $selector ] ) ) {
		return $this->get_clone_setting_field_choice( acf_sanitize_request_args( $_POST['fields'][ $selector ] ) );
	}
	// phpcs:enable WordPress.Security.NonceVerification.Missing

	// field
	if ( acf_is_field_key( $selector ) ) {
		return $this->get_clone_setting_field_choice( acf_get_field( $selector ) );
	}

	// group
	if ( acf_is_field_group_key( $selector ) ) {
		return $this->get_clone_setting_group_choice( acf_get_field_group( $selector ) );
	}

	// return
	return $selector;
}