Last active
November 1, 2015 12:48
-
-
Save BrockReece/e9a892b427958e894e5b to your computer and use it in GitHub Desktop.
Drop-in helper to extend cake form helper to work with bootstrap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
App::uses('FormHelper', 'View/Helper'); | |
class BootstrapFormHelper extends FormHelper { | |
/** | |
* Overide parent method to use bootstrap input classes | |
* | |
* @param string $fieldName name of field to pass to parent method | |
* @param array $options list of options to pass to parent method | |
* | |
* @return string | |
*/ | |
public function input($fieldName, $options = array()) { | |
$defaults = array( | |
'class' => 'form-control', | |
'div' => array( | |
'class' => 'form-group' | |
), | |
); | |
$options = Set::merge($defaults, $options); | |
return parent::input($fieldName, $options); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment