diff --git a/resources/classes/modal.php b/resources/classes/modal.php
index db4d58fce8..fe3ce139fd 100644
--- a/resources/classes/modal.php
+++ b/resources/classes/modal.php
@@ -30,13 +30,14 @@ if (!class_exists('modal')) {
static function create($array) {
- $modal = "
\n";
+ //add multi-lingual support
+ $language = new text;
+ $text = $language->get();
+
+ $modal = "
\n";
$modal .= "
\n";
- $modal .= " ×\n";
- if ($array['type'] != '') {
- //add multi-lingual support
- $language = new text;
- $text = $language->get();
+ $modal .= " ×\n";
+ if (!empty($array['type'])) {
//determine type
switch ($array['type']) {
case 'copy':
@@ -55,11 +56,11 @@ if (!class_exists('modal')) {
$array['title'] = $array['title'] ? $array['title'] : $text['modal_title-confirmation'];
}
//prefix cancel button to action
- $array['actions'] = button::create(['type'=>'button','label'=>$text['button-cancel'],'icon'=>$_SESSION['theme']['button_icon_cancel'],'collapse'=>'never','onclick'=>'modal_close(); '.$array['onclose']]).$array['actions'];
+ $array['actions'] = button::create(['type'=>'button','label'=>$text['button-cancel'],'icon'=>$_SESSION['theme']['button_icon_cancel'],'collapse'=>'never','onclick'=>'modal_close(); '.($array['onclose'] ?? '')]).$array['actions'];
}
- $modal .= $array['title'] ? " ".$array['title']."\n" : null;
- $modal .= $array['message'] ? " ".$array['message']."\n" : null;
- $modal .= $array['actions'] ? " ".$array['actions']."\n" : null;
+ $modal .= !empty($array['title']) ? " ".$array['title']."\n" : null;
+ $modal .= !empty($array['message']) ? " ".$array['message']."\n" : null;
+ $modal .= !empty($array['actions']) ? " ".$array['actions']."\n" : null;
$modal .= "
\n";
$modal .= "
";
@@ -71,4 +72,4 @@ if (!class_exists('modal')) {
}
}
-?>
+?>
\ No newline at end of file