Skip to content

Commit b13b9d3

Browse files
committed
fixed CONFLICT
2 parents a8e412a + c59110d commit b13b9d3

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

Test/Case/View/Helper/BoostCakeHtmlHelperTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ public function testUseTag() {
2424
' label',
2525
'/label'
2626
));
27+
28+
$result = $this->Html->useTag(
29+
'radio', 'one', 'two', array('class' => 'radio-inline', 'three' => 'four'), '<label for="one">label</label>'
30+
);
31+
$this->assertTags($result, array(
32+
'label' => array('class' => 'radio-inline', 'for' => 'one'),
33+
'input' => array('type' => 'radio', 'name' => 'one', 'id' => 'two', 'three' => 'four'),
34+
' label',
35+
'/label'
36+
));
2737
}
2838

2939
public function testImage() {

View/Helper/BoostCakeHtmlHelper.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@ class BoostCakeHtmlHelper extends HtmlHelper {
1414
*/
1515
public function useTag($tag) {
1616
$args = func_get_args();
17+
18+
if ($tag === 'radio') {
19+
$class = (isset($args[3]['class'])) ? $args[3]['class'] : 'radio';
20+
unset($args[3]['class']);
21+
}
22+
1723
$html = call_user_func_array(array('parent', 'useTag'), $args);
1824

1925
if ($tag === 'radio') {
2026
$regex = '/(<label)(.*?>)/';
2127
if (preg_match($regex, $html, $match)) {
22-
$html = $match[1] . ' class="radio"' . $match[2] . preg_replace($regex, ' ', $html);
28+
$html = $match[1] . ' class="' . $class . '"' . $match[2] . preg_replace($regex, ' ', $html);
2329
}
2430
}
2531

0 commit comments

Comments
 (0)