Skip to content

Instantly share code, notes, and snippets.

@stealthinu
Created June 27, 2013 08:20
Show Gist options
  • Save stealthinu/5874836 to your computer and use it in GitHub Desktop.
Save stealthinu/5874836 to your computer and use it in GitHub Desktop.
BootstrapFormHelperのradioボタンをボタンごとにinline指定出来るようにするパッチ
diff --git a/View/Helper/BootstrapFormHelper.php b/View/Helper/BootstrapFormHelper.php
index 89f9814..714709f 100644
--- a/View/Helper/BootstrapFormHelper.php
+++ b/View/Helper/BootstrapFormHelper.php
@@ -114,10 +114,19 @@ class BootstrapFormHelper extends FormHelper {
}
public function radio($fieldName, $radioOptions = array(), $options = array()) {
+ $inlineFlag = false;
+ if (isset($options['inline']) and true == $options['inline']) {
+ $inlineFlag = true;
+ unset($options['inline']);
+ }
$options['legend'] = false;
$options['separator'] = "\n";
$out = parent::radio($fieldName, $radioOptions, $options);
- $out = $this->_restructureLabel($out, array('class' => 'radio'));
+ if ($inlineFlag) {
+ $out = $this->_restructureLabel($out, array('class' => 'radio inline'));
+ } else {
+ $out = $this->_restructureLabel($out, array('class' => 'radio'));
+ }
return $out;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment