From 7a5627067c07dc4702cd25bd0adb1341e67e9c07 Mon Sep 17 00:00:00 2001 From: martin-neumann-gurus <75806177+martin-neumann-gurus@users.noreply.github.com> Date: Fri, 26 Jul 2024 15:03:31 +0200 Subject: [PATCH] Update Container.php The library has a beautiful notification system, but there is no mechanism to add notifications from outside of the class if needed. The add_notification function will give this possibility. I have tested that on a theme_options container, not sure what effect notifications have on other container types. Maybe the same can be done for error messages. --- core/Container/Container.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/Container/Container.php b/core/Container/Container.php index 26cd3760..554d1e3d 100644 --- a/core/Container/Container.php +++ b/core/Container/Container.php @@ -785,6 +785,15 @@ public function set_classes( $classes ) { return $this; } + /** + * Adds a notification to be shown. + * + * @param string $notification + */ + public function add_notification ($notification) { + $this->notifications[] = $notification; + } + /** * Returns an array that holds the container data, suitable for JSON representation. *