From c7763a23bd7f43f8837ac7077664931518ce8e3b Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Wed, 12 Sep 2012 14:40:55 +0300 Subject: [PATCH] Add definition list helper to HTML class. --- laravel/html.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/laravel/html.php b/laravel/html.php index fd5bf82e..e3b2a993 100644 --- a/laravel/html.php +++ b/laravel/html.php @@ -347,6 +347,28 @@ private static function listing($type, $list, $attributes = array()) return '<'.$type.static::attributes($attributes).'>'.$html.''; } + + /** + * Generate a definition list. + * + * @param array $list + * @param array $attributes + * @return string + */ + public static function dl($list, $attributes = array()) + { + $html = ''; + + if (count($list) == 0) return $html; + + foreach ($list as $term => $description) + { + $html .= '
'.static::entities($term).'
'; + $html .= '
'.static::entities($description).'
'; + } + + return ''.$html.''; + } /** * Build a list of HTML attributes from an array.