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)


Top ↑

Parameters Parameters

$notification

(object) (Required) The notification object.


Top ↑

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;
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.