From 28ada1f684c41f06f008bee6afa33f7e272de44b Mon Sep 17 00:00:00 2001 From: gwoo Date: Sun, 25 Nov 2007 20:12:51 +0000 Subject: [PATCH] updating HtmlHelper::nestedList() to accept string type ul/ol as second attribute, also closes #3144 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6079 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/view/helpers/html.php | 6 +++++- cake/tests/cases/libs/view/helpers/html.test.php | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index d02ac4904..df3e5dc43 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -513,13 +513,17 @@ class HtmlHelper extends AppHelper { * Build a nested list (UL/OL) out of an associative array. * * @param array $list Set of elements to list - * @param array $attributes Additional HTML attributes of the list (ol/ul) tag + * @param array $attributes Additional HTML attributes of the list (ol/ul) tag or if ul/ol use that as tag * @param array $itemAttributes Additional HTML attributes of the list item (LI) tag * @param string $tag Type of list tag to use (ol/ul) * @return string The nested list * @access public */ function nestedList($list, $attributes = array(), $itemAttributes = array(), $tag = 'ul') { + if(is_string($attributes)) { + $tag = $attributes; + $attributes = array(); + } $items = $this->__nestedListItem($list, $attributes, $itemAttributes, $tag); return sprintf($this->tags[$tag], $this->_parseAttributes($attributes, null, ' ', ''), $items); } diff --git a/cake/tests/cases/libs/view/helpers/html.test.php b/cake/tests/cases/libs/view/helpers/html.test.php index 6794a58f9..d51c5e34d 100644 --- a/cake/tests/cases/libs/view/helpers/html.test.php +++ b/cake/tests/cases/libs/view/helpers/html.test.php @@ -138,6 +138,14 @@ class HtmlHelperTest extends UnitTestCase { $this->assertPattern('/
  • Item 4.3\s*