Commit Graph

16706 Commits

Author SHA1 Message Date
Justin Shreve 838c27438e Merge branch 'settings-api' of https://github.com/woothemes/woocommerce into settings-api 2016-07-26 11:11:09 -07:00
Justin Shreve 02915e6056 Rename helper class from 'legacy' to be more descriptive of whats happening. Registering wp-admin settings to the REST API. 2016-07-26 11:08:29 -07:00
Justin Shreve 48e6be6dcf Move WP-APIs test server code to a vendor directory, make sure it matches the version of the other vendor files. 2016-07-26 10:24:15 -07:00
Justin Shreve 226fdb870b Misc cleanup of descriptions and some error strings. 2016-07-26 10:24:15 -07:00
Jeff Stieler 1a95055303 Call register_legacy_settings() directly instead of adding another hook. 2016-07-26 10:24:15 -07:00
Jeff Stieler 5c1b3a8d62 Remove now defunct WP API vendor file. 2016-07-26 10:24:15 -07:00
Jeff Stieler 383b5b2944 Move legacy setting API registration hooks into main WC_API class. 2016-07-26 10:24:15 -07:00
Jeff Stieler d77373227a Remove now defunct WC_REST_Settings_API_Controller class. 2016-07-26 10:24:15 -07:00
Jeff Stieler af1e3d0417 Remove WC_REST_Settings_Options_Controller dependency on WC_REST_Settings_API_Controller. 2016-07-26 10:24:15 -07:00
Jeff Stieler 8ff799562b Remove WC_REST_Settings_Controller dependency on WC_REST_Settings_API_Controller. 2016-07-26 10:24:15 -07:00
Jeff Stieler 2fcb15d9cf Rename WC_Rest_Settings_Groups_Controller to WC_Rest_Settings_Controller. 2016-07-26 10:24:15 -07:00
Jeff Stieler f168f356bc Rename WC_Rest_Settings_Controller to WC_Rest_Settings_Options_Controller. 2016-07-26 10:24:15 -07:00
Jeff Stieler e14d77a987 When saving settings, only allow values found in “options” for “select” type fields. 2016-07-26 10:24:15 -07:00
Jeff Stieler a0f227a17c Add test coverage for all WP_Error-returning cases in the Settings API. 2016-07-26 10:24:15 -07:00
Jeff Stieler 91a86efed9 Add test coverage for register_legacy_settings(). 2016-07-26 10:24:15 -07:00
Jeff Stieler b4eaa12f7a Break “legacy” setting to “new” conversion into it’s own method. 2016-07-26 10:24:15 -07:00
Jeff Stieler 51cae9c441 Add test for register_legacy_group() and coverage annotations. 2016-07-26 10:24:15 -07:00
Jeff Stieler 09f7723457 Add initial test file for WC_Register_Legacy_Settings, with test for constructor. 2016-07-26 10:24:15 -07:00
Jeff Stieler cca2a0ff5e Reuse WC Admin Setting’s save_fields() instead of duplicating code for sanitizing saved values. 2016-07-26 10:24:15 -07:00
Jeff Stieler f3e21123d1 Use WC Admin Settings’s get_option() in REST Settings controller instead of duplicating code. 2016-07-26 10:24:15 -07:00
Jeff Stieler 3de28d2356 Take in options data to be saved as an optional argument, defaulting to $_POST.
This allows for reuse of the options field saving mechanism.
2016-07-26 10:24:15 -07:00
Jeff Stieler 83d252b6d3 Remove namespace from Settings API unit test file.
This fails builds on PHP 5.2.x.
2016-07-26 10:24:15 -07:00
Jeff Stieler 95990e32ca Fix unit tests. 2016-07-26 10:24:15 -07:00
Jeff Stieler 4f98586979 Add _links to returned settings groups. 2016-07-26 10:24:15 -07:00
Jeff Stieler bbc5aec1d1 Don’t register legacy settings without IDs. 2016-07-26 10:24:15 -07:00
Jeff Stieler 9d9d318727 Handle select options in setting sanitization function. 2016-07-26 10:24:15 -07:00
Jeff Stieler 24014a5d04 Move bulk settings updating to the Settings controller, following existing batch endpoint patterns. 2016-07-26 10:24:15 -07:00
Jeff Stieler 7c119ac268 Add _links to /settings/<group> and /settings/<group>/<setting> responses. 2016-07-26 10:24:15 -07:00
Jeff Stieler b2c628f0d8 Move settings group endpoint to Settings controller and only return settings-schema’d items. 2016-07-26 10:24:15 -07:00
Jeff Stieler 519be1c519 Add Settings controller getter method for all group settings. 2016-07-26 10:24:15 -07:00
Jeff Stieler b69c9814af Match parent signature of prepare_item_for_response(), add getter method for settings. 2016-07-26 10:24:15 -07:00
Claudio Sanches 7b78a6d9a7 Small tweaks to make it follow the REST API standards 2016-07-26 10:24:15 -07:00
Justin Shreve 56b769614d edit_item should be update_item 2016-07-26 10:24:15 -07:00
Justin Shreve 3c35721bea Rename update_ functions to edit_item, and get_groups/get_settings to get_item and get_items per feedback. Also move the namespace into each class. 2016-07-26 10:24:15 -07:00
Justin Shreve fa27f277a1 Split settings and groups controllers into two separate files. 2016-07-26 10:24:15 -07:00
Justin Shreve 97e7c293d5 Rename classic settings file to legacy settings 2016-07-26 10:24:15 -07:00
Justin Shreve 3f90fecd6e Rename classic -> legacy 2016-07-26 10:24:15 -07:00
Justin Shreve bf1ffbeff8 Fix how classic groups/settings are registered so that they are always avaiable when calling filters. 2016-07-26 10:24:15 -07:00
Justin Shreve 507e40fe10 Remove settings api docs, moving to wiki 2016-07-26 10:24:15 -07:00
Justin Shreve 3de423b5c2 Wrap up settings api 2016-07-26 10:24:15 -07:00
Justin Shreve 5de870bb08 Wrap up settings endpoints for updating, finish tests. 2016-07-26 10:24:15 -07:00
Justin Shreve 46028e0151 Refactor down to two concepts - settings groups and settings. Fix up tests, and start working on returning actual settings and their values. 2016-07-26 10:24:15 -07:00
Justin Shreve 8fee6bd3b9 Add a test for settings groups, make sure any bad keys/values are filtered out, update docs. 2016-07-26 10:24:15 -07:00
Justin Shreve b8a45f031c Add group info to the single locations endpoint & update our docs 2016-07-26 10:24:15 -07:00
Justin Shreve 12aa11d5be Misc cleanup. 2016-07-26 10:24:15 -07:00
Justin Shreve 19d3bc4737 Add a permissions check to the locations endpoints and fill out the tests for them. 2016-07-26 10:24:15 -07:00
Justin Shreve 21b66f94ff More setting location tests. 2016-07-26 10:24:15 -07:00
Justin Shreve 5ee4b5d4dd Add the ability to get data on a single location. 2016-07-26 10:24:15 -07:00
Justin Shreve 6588418227 API Docs for our endpoints this far. 2016-07-26 10:24:15 -07:00
Justin Shreve 11a3c89a2f Make /settings/locations work properly. Add skeleton for tests and add register_routes test. 2016-07-26 10:24:15 -07:00