diff --git a/src/View/Helper/FormHelper.php b/src/View/Helper/FormHelper.php index fb9b36f88d8..322b8c6ab0e 100644 --- a/src/View/Helper/FormHelper.php +++ b/src/View/Helper/FormHelper.php @@ -111,6 +111,8 @@ class FormHelper extends Helper 'label' => '{{text}}', 'nestingLabel' => '{{hidden}}{{input}}{{text}}', 'legend' => '{{text}}', + 'multicheckboxTitle' => '{{text}}', + 'multicheckboxWrapper' => '{{content}}', 'option' => '', 'optgroup' => '{{content}}', 'select' => '', diff --git a/src/View/Widget/MultiCheckboxWidget.php b/src/View/Widget/MultiCheckboxWidget.php index 47b932d949b..bc9dba2a663 100644 --- a/src/View/Widget/MultiCheckboxWidget.php +++ b/src/View/Widget/MultiCheckboxWidget.php @@ -50,8 +50,8 @@ class MultiCheckboxWidget implements WidgetInterface * - `checkboxWrapper` Renders the containing div/element for * a checkbox and its label. Accepts the `input`, and `label` * variables. - * - `fieldset` Renders the fieldset for grouped inputs. - * - `legend` Renders the legend element for grouped inputs. + * - `multicheckboxWrapper` Renders a wrapper around grouped inputs. + * - `multicheckboxTitle` Renders the title element for grouped inputs. * * @param \Cake\View\StringTemplate $templates Templates list. * @param \Cake\View\Widget\LabelWidget $label Label widget instance. @@ -127,9 +127,9 @@ protected function _renderInputs($data, $context) // Grouped inputs in a fieldset. if (is_string($key) && is_array($val) && !isset($val['text'], $val['value'])) { $inputs = $this->_renderInputs(['options' => $val] + $data, $context); - $legend = $this->_templates->format('legend', ['text' => $key]); - $out[] = $this->_templates->format('fieldset', [ - 'content' => $legend . implode('', $inputs) + $title = $this->_templates->format('multicheckboxTitle', ['text' => $key]); + $out[] = $this->_templates->format('multicheckboxWrapper', [ + 'content' => $title . implode('', $inputs) ]); continue; } diff --git a/tests/TestCase/View/Widget/MultiCheckboxWidgetTest.php b/tests/TestCase/View/Widget/MultiCheckboxWidgetTest.php index f58e16a941e..05b75c9971e 100644 --- a/tests/TestCase/View/Widget/MultiCheckboxWidgetTest.php +++ b/tests/TestCase/View/Widget/MultiCheckboxWidgetTest.php @@ -37,8 +37,8 @@ public function setUp() 'checkbox' => '', 'label' => '{{text}}', 'checkboxWrapper' => '
{{input}}{{label}}
', - 'fieldset' => '{{content}}', - 'legend' => '{{text}}', + 'multicheckboxWrapper' => '{{content}}', + 'multicheckboxTitle' => '{{text}}', ]; $this->templates = new StringTemplate($templates); $this->context = $this->getMock('Cake\View\Form\ContextInterface');