WC_CLI_REST_Command::get_context_fields()
Get a list of fields present in a given context
Method of the class: WC_CLI_REST_Command{}
No Hooks.
Return
Array
.
Usage
// private - for code of main (parent) class only $result = $this->get_context_fields( $context );
- $context(string) (required)
- Scope under which the request is made. Determines fields present in response.
WC_CLI_REST_Command::get_context_fields() WC CLI REST Command::get context fields code WC 7.7.0
private function get_context_fields( $context ) { $fields = array(); foreach ( $this->schema['properties'] as $key => $args ) { if ( empty( $args['context'] ) || in_array( $context, $args['context'], true ) ) { $fields[] = $key; } } return $fields; }