Automattic\WooCommerce\Admin\API\Reports
DataStore::selected_columns
Returns a list of columns selected by the query_args formatted as a comma separated string.
Method of the class: DataStore{}
No Hooks.
Returns
String.
Usage
// protected - for code of main (parent) or child class $result = $this->selected_columns( $query_args );
- $query_args(array) (required)
- User-supplied options.
DataStore::selected_columns() DataStore::selected columns code WC 11.0.0
protected function selected_columns( $query_args ) {
$selections = $this->report_columns;
if ( isset( $query_args['fields'] ) && is_array( $query_args['fields'] ) ) {
$keep = array();
foreach ( $query_args['fields'] as $field ) {
if ( isset( $selections[ $field ] ) ) {
$keep[ $field ] = $selections[ $field ];
}
}
$selections = implode( ', ', $keep );
} else {
$selections = implode( ', ', $selections );
}
return $selections;
}