Html::tag now accepts $attributes as a string, in which case, it will be used as the tags class name.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6859 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
joelmoss 2008-05-13 23:09:37 +00:00
parent 65454882f3
commit 9a4c186ccd
2 changed files with 6 additions and 0 deletions

View file

@ -525,6 +525,9 @@ class HtmlHelper extends AppHelper {
if ($escape) {
$text = h($text);
}
if (!is_array($attributes)) {
$attributes = array('class' => $attributes);
}
if ($text === null) {
$tag = 'tagstart';
} else {

View file

@ -651,6 +651,9 @@ class HtmlHelperTest extends CakeTestCase {
$result = $this->Html->tag('div', '<text>', array('class' => 'class-name'), true);
$this->assertTags($result, array('div' => array('class' => 'class-name'), '&lt;text&gt;', '/div'));
$result = $this->Html->tag('div', '<text>', 'class-name', true);
$this->assertTags($result, array('div' => array('class' => 'class-name'), '&lt;text&gt;', '/div'));
}
function testDiv() {