I'm probably using the wrong words to describe things and I'm sorry for that; I'm self-taught and haven't been doing this for very long.
This is a vanilla PHP question; I'm not using a framework or any libraries.
So to start, what I have works fine. If I feed my
FormPresets
FormPresets
class a list of functions to do, it gives me the corresponding preset form fields paired with the appropriate labels, menus, headings, and section information that I expect for the context.
The issue is how I'm storing that data.
At the moment, I have a handful of enums, some of which have up to 21 cases, and inside those enums are a few massive functions that all contain match statements, and those return either a string or an array of strings, and it sucks. There has to be a significantly more manageable way than that.
I have a lot of different contexts here that require different, but still similar, form configurations, which is why I didn't want to go the template file route; I'd just have the same issue I have now, but with even more stuff to keep track of. Everything at the moment is being assembled dynamically. I'm not embedding anything directly into HTML at any point.
With what I'm doing out of the way, are there any patterns or known tried and true ways of doing this sort of thing that anybody would be able to point me to so I can read about it?
I hope it makes sense what I'm looking for; I'm largely seeking advice. If you need me to clarify something or to provide an actual code example, please feel free to ask.