Automattic\WooCommerce\Admin\API\Reports
DataStore::format_join_selections
Returns a comma separated list of the field names prepared to be used for a selection after a join with default_results.
Метод класса: DataStore{}
Хуков нет.
Возвращает
Строку.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->format_join_selections( $fields, $default_results_fields, $outer_selections );
- $fields(массив) (обязательный)
- Array of fields name.
- $default_results_fields(массив) (обязательный)
- Fields to load from default_results table.
- $outer_selections(массив)
- Array of fields that are not selected in the inner query.
По умолчанию: array()
Код DataStore::format_join_selections() DataStore::format join selections WC 10.4.3
protected function format_join_selections( $fields, $default_results_fields, $outer_selections = array() ) {
foreach ( $fields as $i => $field ) {
foreach ( $default_results_fields as $default_results_field ) {
if ( $field === $default_results_field ) {
$field = esc_sql( $field );
$fields[ $i ] = "default_results.{$field} AS {$field}";
}
}
if ( in_array( $field, $outer_selections, true ) && array_key_exists( $field, $this->report_columns ) ) {
$fields[ $i ] = $this->report_columns[ $field ];
}
}
return implode( ', ', $fields );
}