| @@ -336,9 +336,9 @@ | ||
| 336 | 336 | ), |
| 337 | 337 | ) |
| 338 | 338 | ), |
| 339 | 339 | ), |
| 340 | - 'schema' => array(), | |
| 340 | + 'schema' => array( $this, 'wcpos_get_public_send_email_schema' ), | |
| 341 | 341 | ) |
| 342 | 342 | ); |
| 343 | 343 | |
| 344 | 344 | register_rest_route( |
| @@ -1011,8 +1011,34 @@ | ||
| 1011 | 1011 | ), |
| 1012 | 1012 | 'name' => array( |
| 1013 | 1013 | 'description' => __( 'Display name of the order status.', 'woocommerce-pos' ), |
| 1014 | 1014 | 'type' => 'string', |
| 1015 | + 'context' => array( 'view', 'edit' ), | |
| 1016 | + 'readonly' => true, | |
| 1017 | + ), | |
| 1018 | + ), | |
| 1019 | + ); | |
| 1020 | + } | |
| 1021 | + | |
| 1022 | + /** | |
| 1023 | + * Get the route schema for the send-email action. | |
| 1024 | + * | |
| 1025 | + * Registered as the route-level `schema` callback. WordPress invokes it with | |
| 1026 | + * `call_user_func()` whenever a namespace index is requested with | |
| 1027 | + * `context=help`, so it must be a real callable — an empty array there | |
| 1028 | + * passes `isset()` and then fatals with a TypeError. | |
| 1029 | + * | |
| 1030 | + * @return array | |
| 1031 | + */ | |
| 1032 | + public function wcpos_get_public_send_email_schema() { | |
| 1033 | + return array( | |
| 1034 | + '$schema' => 'http://json-schema.org/draft-04/schema#', | |
| 1035 | + 'title' => 'order_email', | |
| 1036 | + 'type' => 'object', | |
| 1037 | + 'properties' => array( | |
| 1038 | + 'success' => array( | |
| 1039 | + 'description' => __( 'Whether the order email was sent.', 'woocommerce-pos' ), | |
| 1040 | + 'type' => 'boolean', | |
| 1015 | 1041 | 'context' => array( 'view', 'edit' ), |
| 1016 | 1042 | 'readonly' => true, |
| 1017 | 1043 | ), |
| 1018 | 1044 | ), |