From daf58049773a1a23cf44cf9579fc2c5069e1c13e Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Thu, 29 Feb 2024 14:56:54 +0200 Subject: [PATCH] - fixed PHP notice on validation; --- includes/core/class-fields.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php index 5aeae98a..ca65616c 100644 --- a/includes/core/class-fields.php +++ b/includes/core/class-fields.php @@ -623,7 +623,10 @@ if ( ! class_exists( 'um\core\Fields' ) ) { * @return string */ public function show_error( $key ) { - return UM()->form()->errors[ $key ]; + if ( empty( UM()->form()->errors ) ) { + return ''; + } + return array_key_exists( $key, UM()->form()->errors ) ? UM()->form()->errors[ $key ] : ''; } /** @@ -634,7 +637,10 @@ if ( ! class_exists( 'um\core\Fields' ) ) { * @return string */ public function show_notice( $key ) { - return UM()->form()->notices[ $key ]; + if ( empty( UM()->form()->notices ) ) { + return ''; + } + return array_key_exists( $key, UM()->form()->notices ) ? UM()->form()->notices[ $key ] : ''; } /**