Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some feature improvements and one bugfix #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions View/Helper/Bs3FormHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,17 @@ protected function _getInput($args) {

// TODO: ver esto... Si es de tipo select multiple con checkbox, no setear clase en checkoxes
if (in_array($type, array('checkbox', 'hidden')) ||
($args['type'] == 'select' &&
(
$args['type'] == 'select' &&
isset($args['options']['multiple']) &&
$args['options']['multiple'] == 'checkbox')) {
$args['options']['multiple'] == 'checkbox'
)
) {

if ($args['options']['class'] == 'form-control'){
unset($args['options']['class']);
if(isset($args['options']['class'])) {
if ($args['options']['class'] == 'form-control'){
unset($args['options']['class']);
}
}
}

Expand Down Expand Up @@ -443,8 +448,8 @@ public function radio($fieldName, $options = array(), $attributes = array()) {

// Opcion inline
$inline = null;
if ($this->_getCustom('inline')) {
$inline = $this->_getCustom('inline');
if (isset($attributes['inline'])) {
$inline = $attributes['inline'];
unset($attributes['inline']);
}

Expand Down Expand Up @@ -501,7 +506,11 @@ public function radio($fieldName, $options = array(), $attributes = array()) {
$labelOpts += array('for' => $tagName);

if ($inline) {
$labelOpts['class'] = 'radio-inline';
if(isset($inline['class'])) {
$labelOpts['class'] = $inline['class'];
} else {
$labelOpts['class'] = 'radio-inline';
}
}
$optLabel = $this->label($tagName, $optHtml . ' ' . $optTitle, $labelOpts);

Expand Down Expand Up @@ -904,6 +913,11 @@ function _setCustom($key, $value) {
*/
protected function _detectFormStyle($options) {
$this->formStyle = $this->_extractOption('formStyle', $options);

if(empty($this->formStyle) && NULL !== Configure::read('Bs3.Form.formStyle')) {
$this->formStyle = Configure::read('Bs3.Form.formStyle');
}

$class = $this->_extractOption('class', $options);

if (!$this->formStyle) {
Expand Down