Automattic\WooCommerce\Admin\API\Reports

DataStore::selected_columns()protectedWC 1.0

Returns a list of columns selected by the query_args formatted as a comma separated string.

Method of the class: DataStore{}

No Hooks.

Return

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() code WC 9.3.3

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;
}