WC_CLI_REST_Command::get_context_fields()privateWC 1.0

Get a list of fields present in a given context

Метод класса: WC_CLI_REST_Command{}

Хуков нет.

Возвращает

Массив.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_context_fields( $context );
$context(строка) (обязательный)
Scope under which the request is made. Determines fields present in response.

Код WC_CLI_REST_Command::get_context_fields() WC 8.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;
}