Hello,
I’m trying to translate a page with a cloned field but i have a bug.
I installed a fresh wordpress to try, with these plugins only :
– Advanced Custom Fields Multilingual
– Advanced Custom Fields PRO
– WPML Multilingual CMS
– WPML String Translation
– WPML Translation Management
I am following the instructions here :
https://wpml.org/documentation/theme-compatibility/setting-wpml-advanced-custom-fields/
But when i try to save my duplicated page, i get an error :
Warning: array_merge(): Argument #2 is not an array in MYWEBSITE/wp-content/plugins/advanced-custom-fields-pro/pro/fields/clone.php on line 230
Fatal error: Uncaught TypeError: Argument 1 passed to WPML_TM_ACF::build_fields_names() must be of the type array, null given, called in MYWEBSITE/wp-content/plugins/wpml-translation-management/classes/compatibility/acf/class-wpml-tm-acf.php on line 116 and defined in MYWEBSITE/wp-content/plugins/wpml-translation-management/classes/compatibility/acf/class-wpml-tm-acf.php:110 Stack trace: #0 MYWEBSITE/wp-content/plugins/wpml-translation-management/classes/compatibility/acf/class-wpml-tm-acf.php(116): WPML_TM_ACF->build_fields_names(NULL, Array) #1 MYWEBSITE/wp-content/plugins/wpml-translation-management/classes/compatibility/acf/class-wpml-tm-acf.php(57): WPML_TM_ACF->build_fields_names(Array) #2 MYWEBSITE/wp-content/plugins/wpml-translation-management/classes/compatibility/acf/class-wpml-tm-acf.php(33): WPML_TM_ACF->update_custom_fields_settings(Array) #3 MYWEBSITE/wp-includes/plu in MYWEBSITE/wp-content/plugins/wpml-translation-management/classes/compatibility/acf/class-wpml-tm-acf.php on line 110
When i try to debug the clone.php file, i made a var_dump of $field_group_fields (l227), which is null, because the acf_get_field_group($selector) (l222) fails.
The $selector value is equals (in my case) at group_57fe54dc67b52, which is my French (first language) clone group, and not the translated one !
My 2 ACF export files (French and English) :
French (original) :
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array (
'key' => 'group_57fe54dc67b52',
'title' => 'my clone field content',
'fields' => array (
array (
'key' => 'field_57fe54e6ed60c',
'label' => 'Text',
'name' => 'text',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
array (
'key' => 'field_57fe54eeed60d',
'label' => 'URL',
'name' => 'url',
'type' => 'url',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
),
),
'location' => array (
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'post',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => 1,
'description' => '',
));
acf_add_local_field_group(array (
'key' => 'group_57fe55021cc04',
'title' => 'my page content',
'fields' => array (
array (
'key' => 'field_57fe55085a8f6',
'label' => 'Page title',
'name' => 'page_title',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
array (
'key' => 'field_57fe55105a8f7',
'label' => 'clone field',
'name' => 'clone_field',
'type' => 'clone',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'clone' => array (
0 => 'group_57fe54dc67b52',
),
'display' => 'group',
'layout' => 'block',
'prefix_label' => 0,
'prefix_name' => 1,
),
),
'location' => array (
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'page',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => 1,
'description' => '',
));
endif;
English (duplicated)
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array (
'key' => 'group_57fe554b53599',
'title' => 'my clone field content in english',
'fields' => array (
array (
'key' => 'field_57fe554b85680',
'label' => 'Text',
'name' => 'text',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
array (
'key' => 'field_57fe554b859b2',
'label' => 'URL',
'name' => 'url',
'type' => 'url',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
),
),
'location' => array (
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'post',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => 1,
'description' => '',
));
acf_add_local_field_group(array (
'key' => 'group_57fe5583ef678',
'title' => 'my page content',
'fields' => array (
array (
'key' => 'field_57fe5584433ba',
'label' => 'Page title',
'name' => 'page_title',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
array (
'key' => 'field_57fe558443497',
'label' => 'clone field',
'name' => 'clone_field',
'type' => 'clone',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'clone' => array (
0 => 'group_57fe554b53599',
),
'display' => 'group',
'layout' => 'block',
'prefix_label' => 0,
'prefix_name' => 1,
),
),
'location' => array (
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'page',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => 1,
'description' => '',
));
endif;
SO, it seems that even if the fields are correctly configurated, ACF tries to get the french clone when i save the english (duplicated) page.
I made a video showing the bug : http://helloddk.com/acf-wpml.html (or direct link : http://helloddk.com/acf-wpml-bug.mp4)
I found this ticket on the WPML forum which seems related : https://wpml.org/fr/forums/topic/les-champs-acf-de-type-clone-apparaissent-vide-sur-le-front/
Can anyone help me ?
Thank you very much !
Andy
Hi @andy-braaxe,
Please open a new support ticket with the same details at [email protected].
Our friendly support team will then be able to take it from there.
The topic ‘Translation of Clone field’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.