Dating example information architecture
An organizational structure is how you define the relationships between pieces of content.
The three main organizational structures are Hierarchical, Sequential, and Matrix.
Computer systems used to be frustrating because they did very little quite badly.
People using systems became frustrated because they simply weren’t capable of doing what they were required to do.
Essentially though, it's going to need a database and not in code.
Create a table "FIELDS" with ID and Name and a table "FIELD_OPTIONS" with an ID, the FIELD_ID and the Name of the option. For example, you could add a column "ALLOWS_MULTISELECT" to the "FIELDS" table to allow the selection of multiple options.