Automator_Notifications::add( array $notification )

Add a manual notification event.


Parameters Parameters

$notification

(Required) Notification data.


Source Source

File: src/core/admin/notifications/notifications.php

	public function add( $notification ) {

		if ( empty( $notification['id'] ) ) {
			return;
		}

		$option = $this->get_option();

		foreach ( $option['dismissed'] as $item ) {
			if ( $item['id'] === $notification['id'] ) {
				return;
			}
		}

		foreach ( $option['events'] as $item ) {
			if ( $item['id'] === $notification['id'] ) {
				return;
			}
		}

		$notification = $this->verify( array( $notification ) );

		update_option(
			$this->option_name,
			array(
				'update'    => $option['update'],
				'feed'      => $option['feed'],
				'events'    => array_merge( $notification, $option['events'] ),
				'dismissed' => $option['dismissed'],
			),
			false
		);
	}


Top ↑

Changelog Changelog

Changelog
Version Description
{VERSION} Introduced.