acf-builder icon indicating copy to clipboard operation
acf-builder copied to clipboard

Simplify Accordion Endpoint

Open Log1x opened this issue 7 years ago • 1 comments

I was looking at the codebase. With Groups, we have ->endGroup() but it seems like ACF dev's handled Accordion's a little differently.

To end an accordion, we effectively have to make a second accordion with a unique key and set endpoint => 1 which you already have a helper for with ->addAccordion('accordion_end')->endPoint().

Any thoughts on a way we could automate the key generation on this, perhaps somehow fetching the previous accordion's key and appending _end to create a simpler syntax such as ->endAccordion()?

Just a thought, not sure if it's possible or sane.

Log1x avatar Sep 15 '18 17:09 Log1x

I think I understand, but confirm that the issue is wanting to end an accordion with having specify add an additional accordion field?

Yeah, I think an endAccordion method would be good, as well as an endTabs (Accordion extends Tab).

I'm not sure the best way to generate the key though, it may have to be done at the transform level (NamespaceFieldKey) when build is being called, only at that point are the other fields names accessible, because it has access to the entire builder object. The fields themselves don't have access to other fields.

stevep avatar Sep 16 '18 14:09 stevep