Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Service/EverblockPrettyBlocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ private static function getPrettyblocksChoicesByCode(
$config = json_decode((string) ($row['config'] ?? ''), true);
$label = '';
if (is_array($config)) {
$label = (string) ($config[$labelField] ?? '');
$labelValue = $config[$labelField] ?? '';
if (is_array($labelValue)) {
$labelValue = reset($labelValue) ?: '';
}
$label = is_scalar($labelValue) ? (string) $labelValue : '';
}
if ($label === '') {
$label = $module->l('Item') . ' #' . $id;
Expand Down
9 changes: 6 additions & 3 deletions src/Service/EverblockTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -3553,7 +3553,8 @@ private static function renderSmartyVarsInArray(string $txt, string $search, arr
if (is_array($value)) {
$txt = static::renderSmartyVarsInArray($txt, $elementSearch, $value);
} else {
$txt = str_replace($elementSearch, $value, $txt);
$replacement = is_scalar($value) ? (string) $value : '';
$txt = str_replace($elementSearch, $replacement, $txt);
}
}
return $txt;
Expand Down Expand Up @@ -4502,7 +4503,8 @@ public static function getCustomerShortcodes(string $txt, Context $context): str
'[entity_gender]' => $gender->name,
];
foreach ($entityShortcodes as $key => $value) {
$txt = str_replace($key, $value, $txt);
$replacement = $value ?? '';
$txt = str_replace($key, (string) $replacement, $txt);
}
return $txt;
}
Expand All @@ -4515,7 +4517,8 @@ public static function getEverShortcodes(string $txt, Context $context): string
);
$returnedShortcodes = [];
foreach ($customShortcodes as $sc) {
$txt = str_replace($sc->shortcode, $sc->content, $txt);
$content = $sc->content ?? '';
$txt = str_replace($sc->shortcode, (string) $content, $txt);
}
return $txt;
}
Expand Down
Loading