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.

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

Хуков нет.

Возвращает

Строку.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->selected_columns( $query_args );
$query_args(массив) (обязательный)
User-supplied options.

Код DataStore::selected_columns() WC 8.7.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;
}