sc0ttkclark / wordpress-fields-api

The 2024 Fields API proposal for WordPress Core
https://make.wordpress.org/core/tag/fields-api/
361 stars 42 forks source link

[8.0] Nested sections / fields / controls #30

Closed sc0ttkclark closed 8 years ago

sc0ttkclark commented 9 years ago

Long term we need to enable nesting for plugins / themes to use the Fields API in the context of #8

sc0ttkclark commented 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:

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.

szepeviktor commented 8 years ago

@sc0ttkclark Could sections / fields / controls be nested in multiple levels? e.g Section / section / fields ...