Home › Forums › Add-ons › Repeater Field › Repeater collapse field not shown
Hi,
I am using ACF pro and WordPress 5.7 with the flynt base theme and try to display the second sub_field if collapsed:
[
'label' => __('Items', 'flynt'),
'name' => 'items',
'type' => 'repeater',
'layout' => 'block',
'collapse' => 'headline',
'min' => 1,
'max' => 4,
'button_label' => 'Hinzufügen',
'sub_fields' => [
[
'label' => __('Icon', 'flynt'),
'name' => 'icon',
'type' => 'text',
],
[
'label' => __('Headline', 'flynt'),
'name' => 'headline',
'type' => 'text',
],
[
'label' => __('Text', 'flynt'),
'name' => 'text',
'type' => 'wysiwyg',
'toolbar' => 'basic',
'media_upload' => 0,
'delay' => 1,
],
],
],
Any ideas why it never shows anything?
So far values I tried: 0, 1, ”, ‘icon’, ‘text’ & ‘headline’
'collapse' => 'field_XXXXXXXXX',
must to be set to the field key of the field you want shown when collapsed.
@hube2 thx for you quick reply…
As the flynt theme is using 'name'
instead of 'key'
and its throwing an error if I use 'key'
… any chance to get the collapse work without the 'key'
?
There isn’t any way to make it work without using the field keys. If the theme is causing an error, what error is it? Not really much that can be done except figure out if you can fix the error.
This is the error code:
Fatal error: Uncaught Exception: Field config must not contain a 'key' property. in /mnt/web509/e2/11/57106911/htdocs/my-wp-folder/wp-content/themes/my-theme/vendor/flyntwp/acf-field-group-composer/lib/ACFComposer/ResolveConfig.php:188 Stack trace: #0 /mnt/web509/e2/11/57106911/htdocs/my-wp-folder/wp-content/themes/my-theme/vendor/flyntwp/acf-field-group-composer/lib/ACFComposer/ResolveConfig.php(111): ACFComposer\ResolveConfig::validateConfig() #1 /mnt/web509/e2/11/57106911/htdocs/my-wp-folder/wp-content/themes/my-theme/vendor/flyntwp/acf-field-group-composer/lib/ACFComposer/ResolveConfig.php(52): ACFComposer\ResolveConfig::forEntity() #2 /mnt/web509/e2/11/57106911/htdocs/my-wp-folder/wp-content/themes/my-theme/vendor/flyntwp/acf-field-group-composer/lib/ACFComposer/ResolveConfig.php(140): ACFComposer\ResolveConfig::forField() #3 [internal function]: ACFComposer\ResolveConfig::ACFComposer\{closure}() #4 /mnt/web509/e2/11/57106911/htdocs/my-wp-folder/wp-con in /mnt/web509/e2/11/57106911/htdocs/my-wp-folder/wp-content/themes/my-theme/vendor/flyntwp/acf-field-group-composer/lib/ACFComposer/ResolveConfig.php on line 188
AFAIK its not allowed to have name
AND key
at the same time. Unfortunately I need the name or my twig template.
any suggestions?
You need to contact the developer of the theme because a feature of their theme is the conflict. Or more precisely something they are using in the theme. Many of the features in ACF depend on field keys and the developer of something that is meant for ACF should be aware of this and there should be something in it that allows you to set the collapse field for the acf repeater. You may need to look into this the “acf-field-group-composer”. Because you are using this you will need to play by their rules.
@hube2 I received an answer in the flynt Q&A on github.
maybe this helps someone else or you can add it in the docu.
You must be logged in to reply to this topic.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.