Skip to content

Commit

Permalink
html class: Allow to pass array as content
Browse files Browse the repository at this point in the history
This allows for a little cleaner code
  • Loading branch information
pabzm committed Feb 17, 2025
1 parent 781f006 commit ff75af7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion program/lib/Roundcube/html.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function show()
*
* @param string $tagname Tag name
* @param array|string $attrib Tag attributes as key/value pairs, or 'class' attribute value
* @param string $content Optional Tag content (creates a container tag)
* @param array|string $content Optional Tag content (creates a container tag)
* @param array $allowed List with allowed attributes, omit to allow all
*
* @return string The XHTML tag
Expand All @@ -81,6 +81,9 @@ public static function tag($tagname, $attrib = [], $content = null, $allowed = n
if (isset($content) || in_array($tagname, self::$containers)) {
$suffix = !empty($attrib['noclose']) ? $suffix : '</' . $tagname . '>' . $suffix;
unset($attrib['noclose'], $attrib['nl']);
if (is_array($content)) {
$content = implode('', $content);
}

return '<' . $tagname . self::attrib_string($attrib, $allowed) . '>' . $content . $suffix;
}
Expand Down

0 comments on commit ff75af7

Please sign in to comment.