Merge pull request #1471 from ultimatemember/fix/warning_on_validation

Wrong Validation PHP notice
This commit is contained in:
Mykyta Synelnikov
2024-02-29 14:58:08 +02:00
committed by GitHub
+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 ] : '';
}
/**