Skip to content

Commit 8895df4

Browse files
committed
refactor(container): Simplify HTML attributes handling in container templates
- Removed the manual construction of HTML attributes string and directly utilized the container attributes array. - Streamlined the rendering process for cleaner and more efficient code.
1 parent 5a2f00f commit 8895df4

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

instructions/guide.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -764,15 +764,8 @@ $containerAttrs = [
764764
'data-max-contentlets' => $container->maxContentlets ?? 0
765765
];
766766

767-
// Build HTML attributes string
768-
$htmlAttrs = '';
769-
foreach ($containerAttrs as $attr => $value) {
770-
if ($value !== null && $value !== '') {
771-
$htmlAttrs .= ' ' . $attr . '="' . htmlspecialchars($value) . '"';
772-
}
773-
}
774767
?>
775-
<div<?= $htmlAttrs ?>>
768+
<div<?= $containerAttrs ?>>
776769
<?php
777770
// Note: dotCMS stores contentlets with a "uuid-" prefix in lowercase
778771
$contentlets = $pageAsset->containers[$identifier]->contentlets[strtolower("uuid-" . $uuid)] ?? null;

0 commit comments

Comments
 (0)