WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

acf_field_clone::get_cloned_fields() public ACF 5.3.8

This function will return an array of fields for a given clone field

{} Это метод класса: acf_field_clone{}

Хуков нет.

Возвращает

(Массив).

Использование

$acf_field_clone = new acf_field_clone();
$acf_field_clone->get_cloned_fields( $field );
$field (обязательный)
-

Список изменений

С версии 5.3.8 Введена.

Код acf_field_clone::get_cloned_fields() ACF 5.9.1

<?php
function get_cloned_fields( $field ) {
	
	// vars
	$fields = array();
	
	
	// bail early if no clone setting
	if( empty($field['clone']) ) return $fields;
	
	
	// bail ealry if already cloning this field (avoid infinite looping)
	if( isset($this->cloning[ $field['key'] ]) ) return $fields;
	
	
	// update local ref
	$this->cloning[ $field['key'] ] = 1;
	
	
	// loop
	foreach( $field['clone'] as $selector ) {
		
		// field group
		if( acf_is_field_group_key($selector) ) {
			
			// vars
			$field_group = acf_get_field_group($selector);
			$field_group_fields = acf_get_fields($field_group);
			
			
			// bail early if no fields
			if( !$field_group_fields ) continue;
			
			
			// append
			$fields = array_merge($fields, $field_group_fields);
			
		// field
		} elseif( acf_is_field_key($selector) ) {
			
			// append
			$fields[] = acf_get_field($selector);
			
		}
		
	}
	
	
	// field has ve been loaded for this $parent, time to remove cloning ref
	unset( $this->cloning[ $field['key'] ] );
	
	
	// clear false values (fields that don't exist)
	$fields = array_filter($fields);
	
	
	// bail early if no sub fields
	if( empty($fields) ) return array();
	
	
	// loop
	// run acf_clone_field() on each cloned field to modify name, key, etc
	foreach( array_keys($fields) as $i ) {
		
		$fields[ $i ] = acf_clone_field( $fields[ $i ], $field );
			
	}
	
	
	// return
	return $fields;
	
}