WC_REST_System_Status_V2_Controller::get_item_mappings_per_fields()
Return an array of sections and the data associated with each.
Method of the class: WC_REST_System_Status_V2_Controller{}
No Hooks.
Return
Array
.
Usage
$WC_REST_System_Status_V2_Controller = new WC_REST_System_Status_V2_Controller(); $WC_REST_System_Status_V2_Controller->get_item_mappings_per_fields( $fields );
- $fields(array) (required)
- List of fields to be included on the response.
Changelog
Since 3.9.0 | Introduced. |
WC_REST_System_Status_V2_Controller::get_item_mappings_per_fields() WC REST System Status V2 Controller::get item mappings per fields code WC 7.7.0
public function get_item_mappings_per_fields( $fields ) { $items = array(); foreach ( $fields as $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': $items['environment'] = $this->get_environment_info_per_fields( $fields ); break; case 'database': $items['database'] = $this->get_database_info(); break; case 'active_plugins': $items['active_plugins'] = $this->get_active_plugins(); break; case 'inactive_plugins': $items['inactive_plugins'] = $this->get_inactive_plugins(); break; case 'dropins_mu_plugins': $items['dropins_mu_plugins'] = $this->get_dropins_mu_plugins(); break; case 'theme': $items['theme'] = $this->get_theme_info(); break; case 'settings': $items['settings'] = $this->get_settings(); break; case 'security': $items['security'] = $this->get_security_info(); break; case 'pages': $items['pages'] = $this->get_pages(); break; case 'post_type_counts': $items['post_type_counts'] = $this->get_post_type_counts(); break; } } return $items; }