Closed sc0ttkclark closed 1 year ago
A few votes for Setting
instead of Field
, needs more discussion.
Current terminology: https://github.com/sc0ttkclark/wordpress-fields-api/blob/develop/docs/terminology.md
@helenhousandi @ericandrewlewis can you both chime in here on an official capacity for what your vote would be, when you have some time?
I don't have a strong preference here at the moment.
My vote would be for "Value," as it has both the advantage of being fairly universally-recognized by developers and abstract enough to accommodate future development without modification. Controls affect Values, which can be associated with whatever arbitrary attribute to whatever object you like.
The more I think about it, the more I lean towards Value as well. GitHub has reactions now, so how about I post the options individually as comments and people react on each :)
Option 1: WP_Fields_API_Field (as it is now)
Option 2: WP_Fields_API_Value
Option 3: WP_Fields_API_Storage
Option 4: WP_Fields_API_Stash
Option 5: WP_Fields_API_Meta
Option 6: WP_Fields_API_Setting (match Customizer)
Option 7: WP_Fields_API_Data
Option 8: WP_Fields_API_Model
Wait, is the thing we’re talking about in this instance literally just the value? Or is it a piece of data that has a name and a value? Because if it’s the former (and the name is specified/stored somewhere else), then Value makes lots of sense; if it’s the latter, Value seems like a weird choice.
A field (mirrors Customizer Setting) consists of an ID (ex. meta_key, option_name, etc) and the methods to get / set a value through the various API functions in WP (ex. get_post_meta / update_post_meta, get_option / update_option, etc). It also handles sanitization, and we're talking about expanding the Field class to including data type and other things related to the REST API.
So, because Yoni asks a great question, may I also try to clarify?
In the context of attribute/value pairs - which as WP developers, we're all familiar with - Field would include the attribute (plus lots of other stuff) and the nominal "Value" would encompass the value?
On Sun, Mar 13, 2016, 8:54 PM Scott Kingsley Clark notifications@github.com wrote:
A field (mirrors Customizer Setting) consists of an ID (ex. meta_key, option_name, etc) and the methods to get / set a value through the various API functions in WP (ex. get_post_meta / update_post_meta, get_option / update_option, etc). It also handles sanitization, and we're talking about expanding the Field class to including data type and other things related to the REST API.
— Reply to this email directly or view it on GitHub https://github.com/sc0ttkclark/wordpress-fields-api/issues/62#issuecomment-196092332 .
The WP_Fields_API_Field
class object exists to store the configuration as it relates to the field itself, in terms of data operations and anything the REST API may need.
The WP_Fields_API_Control
class object exists to render the form input to the screen, based on the control type, any configuration passed to the control, and communicates with the Field to get the value.
Trying to think up how to make Fields vs Controls more clear, because Fields sounds like form fields, but controls are the inputs on the actual form.
Need some input/feedback from @helenhousandi when possible.
A
Control
is the input that appears in a form, which handles showing the current value and letting someone edit that value.A
Field
handles getting, sanitizing, or saving the value and the operations involved in that across all object types.