Skip to content
Permalink
Browse files

Refactoring code to make it possible to nest a input inside a label

  • Loading branch information...
lorenzo committed Mar 7, 2014
1 parent dfc7487 commit e5316ab8043eac134b90d3202e63859cd315762a
Showing with 8 additions and 7 deletions.
  1. +8 −7 src/View/Helper/FormHelper.php
@@ -841,12 +841,6 @@ public function input($fieldName, $options = []) {
$this->templates($options['templates']);
unset($options['templates']);
$label = $this->_getLabel($fieldName, $options);
if ($options['type'] !== 'radio') {
unset($options['label']);
}
$template = 'groupContainer';
$error = null;
if ($options['type'] !== 'hidden' && $options['error'] !== false) {
@@ -855,8 +849,15 @@ public function input($fieldName, $options = []) {
unset($options['error']);
}
$groupTemplate = $options['type'] === 'checkbox' ? 'checkboxFormGroup' : 'formGroup';
$label = $options['label'];
if ($options['type'] !== 'radio') {
unset($options['label']);
}
$input = $this->_getInput($fieldName, $options);
$label = $this->_getLabel($fieldName, compact('input', 'label') + $options);
$groupTemplate = $options['type'] === 'checkbox' ? 'checkboxFormGroup' : 'formGroup';
$result = $this->formatTemplate($groupTemplate, compact('input', 'label'));
if ($options['type'] !== 'hidden') {

0 comments on commit e5316ab

Please sign in to comment.
You can’t perform that action at this time.