From be8ec903b53b6b1bb292d90c29b90232384c6d66 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Tue, 21 Mar 2017 17:47:28 -0300 Subject: [PATCH 1/2] Include missing payment gateways and shippingmethods settings schema --- ...ss-wc-rest-payment-gateways-controller.php | 50 +++++++++++++++++++ ...ss-wc-rest-settings-options-controller.php | 3 +- ...-rest-shipping-zone-methods-controller.php | 50 +++++++++++++++++++ 3 files changed, 102 insertions(+), 1 deletion(-) diff --git a/includes/api/class-wc-rest-payment-gateways-controller.php b/includes/api/class-wc-rest-payment-gateways-controller.php index 42597e91421..a5e7044302f 100644 --- a/includes/api/class-wc-rest-payment-gateways-controller.php +++ b/includes/api/class-wc-rest-payment-gateways-controller.php @@ -385,6 +385,56 @@ class WC_REST_Payment_Gateways_Controller extends WC_REST_Controller { 'description' => __( 'Payment gateway settings.', 'woocommerce' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), + 'properties' => array( + 'id' => array( + 'description' => __( 'A unique identifier for the setting.', 'woocommerce' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + 'readonly' => true, + ), + 'label' => array( + 'description' => __( 'A human readable translation wrapped label. Meant to be used in interfaces.', 'woocommerce' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + 'readonly' => true, + ), + 'description' => array( + 'description' => __( 'A human readable translation wrapped description. Meant to be used in interfaces.', 'woocommerce' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + 'readonly' => true, + ), + 'type' => array( + 'description' => __( 'Type of setting.', 'woocommerce' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + 'enum' => array( 'text', 'email', 'number', 'color', 'password', 'textarea', 'select', 'multiselect', 'radio', 'image_width', 'checkbox' ), + 'readonly' => true, + ), + 'value' => array( + 'description' => __( 'Setting value.', 'woocommerce' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + ), + 'default' => array( + 'description' => __( 'Default value for the setting.', 'woocommerce' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + 'readonly' => true, + ), + 'tip' => array( + 'description' => __( 'Extra help text explaining the setting.', 'woocommerce' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + 'readonly' => true, + ), + 'placeholder' => array( + 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + 'readonly' => true, + ), + ), ), ), ); diff --git a/includes/api/class-wc-rest-settings-options-controller.php b/includes/api/class-wc-rest-settings-options-controller.php index f444bfde3d2..45ab7cd5f80 100644 --- a/includes/api/class-wc-rest-settings-options-controller.php +++ b/includes/api/class-wc-rest-settings-options-controller.php @@ -517,12 +517,13 @@ class WC_REST_Settings_Options_Controller extends WC_REST_Controller { 'readonly' => true, ), 'type' => array( - 'description' => __( 'Type of setting. Allowed values: text, email, number, color, password, textarea, select, multiselect, radio, image_width, checkbox.', 'woocommerce' ), + 'description' => __( 'Type of setting.', 'woocommerce' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), 'context' => array( 'view', 'edit' ), + 'enum' => array( 'text', 'email', 'number', 'color', 'password', 'textarea', 'select', 'multiselect', 'radio', 'image_width', 'checkbox' ), 'readonly' => true, ), 'options' => array( diff --git a/includes/api/class-wc-rest-shipping-zone-methods-controller.php b/includes/api/class-wc-rest-shipping-zone-methods-controller.php index 93fca25e551..2098bb2638d 100644 --- a/includes/api/class-wc-rest-shipping-zone-methods-controller.php +++ b/includes/api/class-wc-rest-shipping-zone-methods-controller.php @@ -472,6 +472,56 @@ class WC_REST_Shipping_Zone_Methods_Controller extends WC_REST_Shipping_Zones_Co 'description' => __( 'Shipping method settings.', 'woocommerce' ), 'type' => 'object', 'context' => array( 'view', 'edit' ), + 'properties' => array( + 'id' => array( + 'description' => __( 'A unique identifier for the setting.', 'woocommerce' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + 'readonly' => true, + ), + 'label' => array( + 'description' => __( 'A human readable translation wrapped label. Meant to be used in interfaces.', 'woocommerce' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + 'readonly' => true, + ), + 'description' => array( + 'description' => __( 'A human readable translation wrapped description. Meant to be used in interfaces.', 'woocommerce' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + 'readonly' => true, + ), + 'type' => array( + 'description' => __( 'Type of setting.', 'woocommerce' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + 'enum' => array( 'text', 'email', 'number', 'color', 'password', 'textarea', 'select', 'multiselect', 'radio', 'image_width', 'checkbox' ), + 'readonly' => true, + ), + 'value' => array( + 'description' => __( 'Setting value.', 'woocommerce' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + ), + 'default' => array( + 'description' => __( 'Default value for the setting.', 'woocommerce' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + 'readonly' => true, + ), + 'tip' => array( + 'description' => __( 'Extra help text explaining the setting.', 'woocommerce' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + 'readonly' => true, + ), + 'placeholder' => array( + 'description' => __( 'Placeholder text to be displayed in text inputs.', 'woocommerce' ), + 'type' => 'string', + 'context' => array( 'view', 'edit' ), + 'readonly' => true, + ), + ), ), ), ); From 8184757e8ae560bf85b6efbf1182c1880a438e35 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 22 Mar 2017 10:51:52 -0300 Subject: [PATCH 2/2] Improved descrition of items in schema --- includes/api/class-wc-rest-payment-gateways-controller.php | 6 +++--- includes/api/class-wc-rest-settings-controller.php | 4 ++-- includes/api/class-wc-rest-settings-options-controller.php | 6 +++--- .../api/class-wc-rest-shipping-zone-methods-controller.php | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/includes/api/class-wc-rest-payment-gateways-controller.php b/includes/api/class-wc-rest-payment-gateways-controller.php index a5e7044302f..60b6b2eb548 100644 --- a/includes/api/class-wc-rest-payment-gateways-controller.php +++ b/includes/api/class-wc-rest-payment-gateways-controller.php @@ -393,13 +393,13 @@ class WC_REST_Payment_Gateways_Controller extends WC_REST_Controller { 'readonly' => true, ), 'label' => array( - 'description' => __( 'A human readable translation wrapped label. Meant to be used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'A human readable translation wrapped description. Meant to be used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -423,7 +423,7 @@ class WC_REST_Payment_Gateways_Controller extends WC_REST_Controller { 'readonly' => true, ), 'tip' => array( - 'description' => __( 'Extra help text explaining the setting.', 'woocommerce' ), + 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, diff --git a/includes/api/class-wc-rest-settings-controller.php b/includes/api/class-wc-rest-settings-controller.php index a5d07f027a9..396c1a2fd6d 100644 --- a/includes/api/class-wc-rest-settings-controller.php +++ b/includes/api/class-wc-rest-settings-controller.php @@ -203,14 +203,14 @@ class WC_REST_Settings_Controller extends WC_REST_Controller { ), ), 'label' => array( - 'description' => __( 'A human readable translation wrapped label. Meant to be used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', ), ), 'description' => array( - 'description' => __( 'A human readable translation wrapped description. Meant to be used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', diff --git a/includes/api/class-wc-rest-settings-options-controller.php b/includes/api/class-wc-rest-settings-options-controller.php index 45ab7cd5f80..242227e171b 100644 --- a/includes/api/class-wc-rest-settings-options-controller.php +++ b/includes/api/class-wc-rest-settings-options-controller.php @@ -470,7 +470,7 @@ class WC_REST_Settings_Options_Controller extends WC_REST_Controller { 'readonly' => true, ), 'label' => array( - 'description' => __( 'A human readable translation wrapped label. Meant to be used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', @@ -479,7 +479,7 @@ class WC_REST_Settings_Options_Controller extends WC_REST_Controller { 'readonly' => true, ), 'description' => array( - 'description' => __( 'A human readable translation wrapped description. Meant to be used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', @@ -499,7 +499,7 @@ class WC_REST_Settings_Options_Controller extends WC_REST_Controller { 'readonly' => true, ), 'tip' => array( - 'description' => __( 'Extra help text explaining the setting.', 'woocommerce' ), + 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce' ), 'type' => 'string', 'arg_options' => array( 'sanitize_callback' => 'sanitize_text_field', diff --git a/includes/api/class-wc-rest-shipping-zone-methods-controller.php b/includes/api/class-wc-rest-shipping-zone-methods-controller.php index 2098bb2638d..264f6d14355 100644 --- a/includes/api/class-wc-rest-shipping-zone-methods-controller.php +++ b/includes/api/class-wc-rest-shipping-zone-methods-controller.php @@ -480,13 +480,13 @@ class WC_REST_Shipping_Zone_Methods_Controller extends WC_REST_Shipping_Zones_Co 'readonly' => true, ), 'label' => array( - 'description' => __( 'A human readable translation wrapped label. Meant to be used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable label for the setting used in interfaces.', 'woocommerce' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, ), 'description' => array( - 'description' => __( 'A human readable translation wrapped description. Meant to be used in interfaces.', 'woocommerce' ), + 'description' => __( 'A human readable description for the setting used in interfaces.', 'woocommerce' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true, @@ -510,7 +510,7 @@ class WC_REST_Shipping_Zone_Methods_Controller extends WC_REST_Shipping_Zones_Co 'readonly' => true, ), 'tip' => array( - 'description' => __( 'Extra help text explaining the setting.', 'woocommerce' ), + 'description' => __( 'Additional help text shown to the user about the setting.', 'woocommerce' ), 'type' => 'string', 'context' => array( 'view', 'edit' ), 'readonly' => true,