- fixed PHP notice on validation;

This commit is contained in:
Mykyta Synelnikov
2024-02-29 14:56:54 +02:00
parent 00e28c27da
commit daf5804977
+8 -2
View File
@@ -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 ] : '';
}
/**