| @@ -67,9 +67,9 @@ | ||
| 67 | 67 | public function get_settings() { |
| 68 | 68 | $settings = get_all_plugin_options(); |
| 69 | 69 | |
| 70 | 70 | if ( $settings ) { |
| 71 | - return new WP_REST_Response( $settings, 200 ); | |
| 71 | + return new WP_REST_Response( [ 'settings' => $settings ], 200 ); | |
| 72 | 72 | } else { |
| 73 | 73 | return new WP_Error( '404', __( 'Something went wrong, the settings could not be found.', 'content-control' ), [ 'status' => 404 ] ); |
| 74 | 74 | } |
| 75 | 75 | } |
| @@ -81,9 +81,9 @@ | ||
| 81 | 81 | * |
| 82 | 82 | * @return \WP_Error|\WP_REST_Response |
| 83 | 83 | */ |
| 84 | 84 | public function update_settings( $request ) { |
| 85 | - $settings = $request->get_params(); | |
| 85 | + $settings = $request->get_param( 'settings' ); | |
| 86 | 86 | |
| 87 | 87 | $error_message = __( 'Something went wrong, the settings could not be updated.', 'content-control' ); |
| 88 | 88 | |
| 89 | 89 | if ( ! get_all_plugin_options() ) { |
| @@ -126,34 +126,10 @@ | ||
| 126 | 126 | '$schema' => 'http://json-schema.org/draft-04/schema#', |
| 127 | 127 | 'title' => 'settings', |
| 128 | 128 | 'type' => 'object', |
| 129 | 129 | 'properties' => [ |
| 130 | - 'block_controls' => [ | |
| 131 | - 'type' => 'object', | |
| 132 | - 'properties' => [ | |
| 133 | - 'enable' => [ | |
| 134 | - 'type' => 'boolean', | |
| 135 | - ], | |
| 136 | - 'controls' => [ | |
| 137 | - 'type' => 'object', | |
| 138 | - 'properties' => [ | |
| 139 | - 'device_rules' => [ | |
| 140 | - 'type' => 'object', | |
| 141 | - 'properties' => [ | |
| 142 | - 'enable' => [ | |
| 143 | - 'type' => 'boolean', | |
| 144 | - ], | |
| 145 | - ], | |
| 146 | - ], | |
| 147 | - ], | |
| 148 | - ], | |
| 149 | - 'disabled_blocks' => [ | |
| 150 | - 'type' => 'array', | |
| 151 | - 'items' => [ | |
| 152 | - 'type' => 'string', | |
| 153 | - ], | |
| 154 | - ], | |
| 155 | - ], | |
| 130 | + 'settings' => [ | |
| 131 | + 'type' => 'object', | |
| 156 | 132 | ], |
| 157 | 133 | ], |
| 158 | 134 | ] |
| 159 | 135 | ); |