Skip to content

Commit ff75af7

Browse files
committed
html class: Allow to pass array as content
This allows for a little cleaner code
1 parent 781f006 commit ff75af7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

program/lib/Roundcube/html.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function show()
6363
*
6464
* @param string $tagname Tag name
6565
* @param array|string $attrib Tag attributes as key/value pairs, or 'class' attribute value
66-
* @param string $content Optional Tag content (creates a container tag)
66+
* @param array|string $content Optional Tag content (creates a container tag)
6767
* @param array $allowed List with allowed attributes, omit to allow all
6868
*
6969
* @return string The XHTML tag
@@ -81,6 +81,9 @@ public static function tag($tagname, $attrib = [], $content = null, $allowed = n
8181
if (isset($content) || in_array($tagname, self::$containers)) {
8282
$suffix = !empty($attrib['noclose']) ? $suffix : '</' . $tagname . '>' . $suffix;
8383
unset($attrib['noclose'], $attrib['nl']);
84+
if (is_array($content)) {
85+
$content = implode('', $content);
86+
}
8487

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

0 commit comments

Comments
 (0)