WC_Helper::get_filters_counts()
Get counts data for the filters array.
Метод класса: WC_Helper{}
Хуков нет.
Возвращает
Массив
. Filter counts (filter => count).
Использование
$result = WC_Helper::get_filters_counts( $subscriptions );
- $subscriptions(массив)
- The array of all available subscriptions.
По умолчанию: null
Код WC_Helper::get_filters_counts() WC Helper::get filters counts WC 8.7.0
public static function get_filters_counts( $subscriptions = null ) { static $filters; if ( isset( $filters ) ) { return $filters; } $filters = array_fill_keys( array_keys( self::get_filters() ), 0 ); if ( ! is_array( $subscriptions ) || empty( $subscriptions ) ) { return array(); } foreach ( $filters as $key => $count ) { $_subs = $subscriptions; self::_filter( $_subs, $key ); $filters[ $key ] = count( $_subs ); } return $filters; }