Automattic\WooCommerce\Admin\API\Reports
Segmenter::prepare_selections()
Filters definitions for SELECT clauses based on query_args and joins them into one string usable in SELECT clause.
Метод класса: Segmenter{}
Хуков нет.
Возвращает
Строку
. to be used in SELECT clause statements.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->prepare_selections( $columns_mapping );
- $columns_mapping(массив) (обязательный)
- Column name -> SQL statememt mapping.
Код Segmenter::prepare_selections() Segmenter::prepare selections WC 9.7.1
protected function prepare_selections( $columns_mapping ) { if ( isset( $this->query_args['fields'] ) && is_array( $this->query_args['fields'] ) ) { $keep = array(); foreach ( $this->query_args['fields'] as $field ) { if ( isset( $columns_mapping[ $field ] ) ) { $keep[ $field ] = $columns_mapping[ $field ]; } } $selections = implode( ', ', $keep ); } else { $selections = implode( ', ', $columns_mapping ); } if ( $selections ) { $selections = ',' . $selections; } return $selections; }