WC_Admin_Marketplace_Promotions::get_promotions_of_format()
From the array of promotions, select those of a given format.
Метод класса: WC_Admin_Marketplace_Promotions{}
Хуков нет.
Возвращает
Массив
.
Использование
$result = WC_Admin_Marketplace_Promotions::get_promotions_of_format( $promotions, $format ): array;
- $promotions(?array)
- Array of data about promotions of all formats.
По умолчанию: array() - $format(?string)
- Format we want to filter for.
По умолчанию: ''
Код WC_Admin_Marketplace_Promotions::get_promotions_of_format() WC Admin Marketplace Promotions::get promotions of format WC 9.4.2
private static function get_promotions_of_format( $promotions = array(), $format = '' ): array { if ( empty( $promotions ) || empty( $format ) ) { return array(); } return array_filter( $promotions, function( $promotion ) use ( $format ) { return isset( $promotion['format'] ) && $format === $promotion['format']; } ); }