Gocodebox_Banner_Notifier::should_show_notification( object $notification )
Check a notification to see if we should show it based on the rules set.
Description Description
Shows if ALL rules are true. (AND)
Parameters Parameters
- $notification
-
(object) (Required) The notification object.
Source Source
File: libraries/banner-notifications/src/notifications.php
function should_show_notification( $notification ) {
// default to showing.
$show = true;
if ( ! empty( $notification->show_if ) ) {
foreach ( $notification->show_if as $test => $data ) {
$test_filter = $this->prefix . '_notification_test_' . $test;
$show = apply_filters( $test_filter, false, $data );
if ( ! $show ) {
// one test failed, let's not show
break;
}
}
}
return $show;
}
Expand full source code Collapse full source code View on GitHub