Yoast_Notification_Center::update_storage()
Save persistent notifications to storage.
We need to be able to retrieve these so they can be dismissed at any time during the execution.
Метод класса: Yoast_Notification_Center{}
Хуки из метода
Возвращает
null
. Ничего (null).
Использование
$Yoast_Notification_Center = new Yoast_Notification_Center(); $Yoast_Notification_Center->update_storage();
Список изменений
С версии 3.2 | Введена. |
Код Yoast_Notification_Center::update_storage() Yoast Notification Center::update storage Yoast 23.4
public function update_storage() { $notifications = $this->notifications; /** * One array of Yoast_Notifications, merged from multiple arrays. * * @var Yoast_Notification[] $merged_notifications */ $merged_notifications = []; if ( ! empty( $notifications ) ) { $merged_notifications = array_merge( ...$notifications ); } /** * Filter: 'yoast_notifications_before_storage' - Allows developer to filter notifications before saving them. * * @param Yoast_Notification[] $notifications */ $filtered_merged_notifications = apply_filters( 'yoast_notifications_before_storage', $merged_notifications ); // The notifications were filtered and therefore need to be stored. if ( $merged_notifications !== $filtered_merged_notifications ) { $merged_notifications = $filtered_merged_notifications; $this->notifications_need_storage = true; } $notifications = $this->split_on_user_id( $merged_notifications ); // No notifications to store, clear storage if it was previously present. if ( empty( $notifications ) ) { $this->remove_storage(); return; } // Only store notifications if changes are made. if ( $this->notifications_need_storage ) { array_walk( $notifications, [ $this, 'store_notifications_for_user' ] ); } }