Skip to content

Commit

Permalink
fix TypeError array_merge() parameter #1 must be of type array, strin…
Browse files Browse the repository at this point in the history
…g given
  • Loading branch information
ralfbecker committed Jul 15, 2024
1 parent 445c0b9 commit abfb542
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api/src/Etemplate/Widget/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ public function validate($cname, array $expand, array $content, &$validated=arra
}
// Link widgets can share IDs, make sure to preserve values from others
$already = self::get_array($validated, $form_name, false, true);
if($already != null)
if(!empty($already) && $already != $value)
{
$value = array_merge((array)$value, $already);
$value = array_merge((array)$value, (array)$already);
}
// Automatically do link if user selected entry but didn't click 'Link' button
$link = self::get_array($content, self::form_name($cname, $this->id . '_link_entry'));
Expand Down Expand Up @@ -469,4 +469,4 @@ public function validate($cname, array $expand, array $content, &$validated=arra
//error_log(" " . array2string($valid));
}
}
}
}

0 comments on commit abfb542

Please sign in to comment.