Fix default value assignment in PageForm schema: Updated logic to ensure that when the default value is an array, the first element is used for header data assignment. This change improves data handling and consistency in form population.
This commit is contained in:
@@ -573,6 +573,9 @@ class PageForm
|
|||||||
$existingData[$key] === null ||
|
$existingData[$key] === null ||
|
||||||
$existingData[$key] === '' ||
|
$existingData[$key] === '' ||
|
||||||
(is_array($existingData[$key]) && empty($existingData[$key]))) {
|
(is_array($existingData[$key]) && empty($existingData[$key]))) {
|
||||||
|
if(is_array($defaultValue)) {
|
||||||
|
$defaultValue = reset($defaultValue);
|
||||||
|
}
|
||||||
$set("header_data.{$key}", $defaultValue);
|
$set("header_data.{$key}", $defaultValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user