Automattic\WooCommerce\Internal\Admin\Suggestions\Incentives
Incentive::get_dismissals()
Get the dismissals (contexts) for an incentive.
Метод класса: Incentive{}
Хуков нет.
Возвращает
Массив
. The contexts in which the incentive has been dismissed.
Использование
$Incentive = new Incentive(); $Incentive->get_dismissals( $id ): array;
- $id(строка) (обязательный)
- The incentive ID.
Код Incentive::get_dismissals() Incentive::get dismissals WC 9.6.1
public function get_dismissals( string $id ): array { $all_dismissed_incentives = $this->get_all_dismissed_incentives(); // If there are no dismissed incentives for the suggestion, return early. $dismissed_incentives = $all_dismissed_incentives[ $this->suggestion_id ] ?? array(); if ( empty( $dismissed_incentives ) ) { return array(); } $dismissals = array_filter( $dismissed_incentives, fn( $dismissed_incentive ) => $id === $dismissed_incentive['id'] ); return array_column( $dismissals, 'context' ); }