Extract top-level property
Using _fields, we can specify a sub-property like environment.version. In that case, we need to extract the top-level property so we known which function to run.
This commit is contained in:
parent
30f41c96e8
commit
b6b5b8f33b
|
@ -612,7 +612,10 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
|
||||||
$items = array();
|
$items = array();
|
||||||
|
|
||||||
foreach ( $fields as $field ) {
|
foreach ( $fields as $field ) {
|
||||||
switch ( $field ) {
|
// If we're looking for a sub-property, like environment.version we need
|
||||||
|
// to extract the first-level property here so we know which function to run.
|
||||||
|
list( $prop ) = explode( '.', $field, 2 );
|
||||||
|
switch ( $prop ) {
|
||||||
case 'environment':
|
case 'environment':
|
||||||
$items['environment'] = $this->get_environment_info_per_fields( $fields );
|
$items['environment'] = $this->get_environment_info_per_fields( $fields );
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue