From 7381b008e03c0c4148909509d5003ec75eecb5e4 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Fri, 24 Mar 2017 01:54:59 -0300 Subject: [PATCH] [REST API] Fixed links for settings endpoint Do not allow embed and updated the key to reflect the items from the endpoint response --- includes/api/class-wc-rest-settings-controller.php | 5 ++--- tests/unit-tests/api/settings.php | 10 ++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/includes/api/class-wc-rest-settings-controller.php b/includes/api/class-wc-rest-settings-controller.php index 396c1a2fd6d..55f6583aa26 100644 --- a/includes/api/class-wc-rest-settings-controller.php +++ b/includes/api/class-wc-rest-settings-controller.php @@ -97,9 +97,8 @@ class WC_REST_Settings_Controller extends WC_REST_Controller { protected function prepare_links( $group_id ) { $base = '/' . $this->namespace . '/' . $this->rest_base; $links = array( - 'item' => array( - 'href' => rest_url( trailingslashit( $base ) . $group_id ), - 'embeddable' => true, + 'options' => array( + 'href' => rest_url( trailingslashit( $base ) . $group_id ), ), ); diff --git a/tests/unit-tests/api/settings.php b/tests/unit-tests/api/settings.php index cb1192ab4ed..20e8dc67853 100644 --- a/tests/unit-tests/api/settings.php +++ b/tests/unit-tests/api/settings.php @@ -52,10 +52,9 @@ class Settings extends WC_REST_Unit_Test_Case { 'description' => 'My awesome test settings.', 'sub_groups' => array( 'sub-test' ), '_links' => array( - 'item' => array( + 'options' => array( array( - 'href' => rest_url( '/wc/v2/settings/test' ), - 'embeddable' => true, + 'href' => rest_url( '/wc/v2/settings/test' ), ), ), ), @@ -68,10 +67,9 @@ class Settings extends WC_REST_Unit_Test_Case { 'description' => '', 'sub_groups' => array(), '_links' => array( - 'item' => array( + 'options' => array( array( - 'href' => rest_url( '/wc/v2/settings/sub-test' ), - 'embeddable' => true, + 'href' => rest_url( '/wc/v2/settings/sub-test' ), ), ), ),