Skip to content

Commit

Permalink
Not been using it, just thought it might help
Browse files Browse the repository at this point in the history
  • Loading branch information
ceeram committed Mar 19, 2012
1 parent 5848585 commit a0af998
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions View/Helper/BootstrapFormHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,23 @@ public function create($model = null, $options = array()) {
$options = $model;
$model = null;
}
$defaults = array(
'class' => 'form-horizontal',
);
$options = Set::merge($defaults, $options);

return parent::create($model, $options);
}

/**
* Add divs and classes necessary for bootstrap
*
*/
public function input($fieldName, $options = array()) {
$defaults = array(
$inputDefaults = array(
'div' => array('class' => 'control-group'),
'label' => array('class' => 'control-label'),
'between' => '<div class="controls">',
'after' => '</div>',
'format' => array('before', 'label', 'between', 'input', 'error', 'after')
);
if (!empty($options['inputDefaults'])) {
$inputDefaults = Set::merge($inputDefaults, $options['inputDefaults']);
}
$defaults = array(
'class' => 'form-horizontal',
'inputDefaults' => $inputDefaults
);
$options = Set::merge($defaults, $options);

return parent::input($fieldName, $options);
return parent::create($model, $options);
}

/**
Expand Down

0 comments on commit a0af998

Please sign in to comment.