Yoast_Notification_Center::array_to_notification()privateYoast 1.0

Convert stored array to Notification.

Метод класса: Yoast_Notification_Center{}

Хуков нет.

Возвращает

Yoast_Notification.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->array_to_notification( $notification_data );
$notification_data(массив) (обязательный)
Array to convert to Notification.

Код Yoast_Notification_Center::array_to_notification() Yoast 22.4

private function array_to_notification( $notification_data ) {

	if ( isset( $notification_data['options']['nonce'] ) ) {
		unset( $notification_data['options']['nonce'] );
	}

	if ( isset( $notification_data['message'] )
		&& is_subclass_of( $notification_data['message'], Abstract_Presenter::class, false )
	) {
		$notification_data['message'] = $notification_data['message']->present();
	}

	if ( isset( $notification_data['options']['user'] ) ) {
		$notification_data['options']['user_id'] = $notification_data['options']['user']->ID;
		unset( $notification_data['options']['user'] );

		$this->notifications_need_storage = true;
	}

	return new Yoast_Notification(
		$notification_data['message'],
		$notification_data['options']
	);
}