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

Consider renaming 'Field' to another term to make things less confusing for Controls #62

Closed sc0ttkclark closed 1 year ago

sc0ttkclark commented 8 years ago

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.

sc0ttkclark commented 8 years ago

A few votes for Setting instead of Field, needs more discussion.

sc0ttkclark commented 8 years ago

Current terminology: https://github.com/sc0ttkclark/wordpress-fields-api/blob/develop/docs/terminology.md

terminology

sc0ttkclark commented 8 years ago

@helenhousandi @ericandrewlewis can you both chime in here on an official capacity for what your vote would be, when you have some time?

ericandrewlewis commented 8 years ago

I don't have a strong preference here at the moment.

holisticnetworking commented 8 years ago

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.

sc0ttkclark commented 8 years ago

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 :)

sc0ttkclark commented 8 years ago

Option 1: WP_Fields_API_Field (as it is now)

sc0ttkclark commented 8 years ago

Option 2: WP_Fields_API_Value

sc0ttkclark commented 8 years ago

Option 3: WP_Fields_API_Storage

sc0ttkclark commented 8 years ago

Option 4: WP_Fields_API_Stash

sc0ttkclark commented 8 years ago

Option 5: WP_Fields_API_Meta

sc0ttkclark commented 8 years ago

Option 6: WP_Fields_API_Setting (match Customizer)

sc0ttkclark commented 8 years ago

Option 7: WP_Fields_API_Data

ericandrewlewis commented 8 years ago

Option 8: WP_Fields_API_Model

ymazuz commented 8 years ago

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.

sc0ttkclark commented 8 years ago

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.

holisticnetworking commented 8 years ago

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 .

sc0ttkclark commented 8 years ago

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.