Closed sc0ttkclark closed 8 years ago
Nesting is now allowed, not utilized by default in the rendering of forms, sections, and controls, but can be utilized through custom form types, custom section types, or custom control types.
When adding a form, section, or control, you can specify form
, section
, control
as a parent. Multiple parents do not get taken into account through the API, arrays won't work. Also multiple parent types will not work, it goes from top to bottom (checks form first, then section, then control).
To get a parent object, use $this->get_parent()
.
To get children objects of a specific type, use:
$sections = $this->get_sections();
$controls = $this->get_controls();
Setting form
for a form object parent is not advised, the API does not provide a $this->get_forms()
in object context, and does not provide a way to limit forms by a specific parent.
@sc0ttkclark Could sections / fields / controls be nested in multiple levels? e.g Section / section / fields ...
Long term we need to enable nesting for plugins / themes to use the Fields API in the context of #8