Proposal: add a dl method to HtmlBuilder

Method generates a description list of items.
This commit is contained in:
Devin Dombrowski - Locutus committed 2015-02-18 13:57:38 -08:00
1 parent f229d1e629
commit 6e459dc808
2 files changed
+68

No files matched your search

+23
View File
@@ -239,6 +239,29 @@ class HtmlBuilder {
return $this->listing('ul', $list, $attributes);
}
/**
* Generate a description list of items.
*
* @param array $list
* @param array $attributes
* @return string
*/
public function dl(array $list, array $attributes = [])
{
$attributes = $this->attributes($attributes);
$html = "<dl{$attributes}>";
foreach ($list as $key => $value)
{
$html .= "<dt>$key</dt><dd>$value</dd>";
}
$html .= '</dl>';
return $html;
}
/**
* Create a listing HTML element.
*