Forked from malteo/sfWidgetFormSchemaFormatterBootstrap.class.php
Created
March 12, 2012 18:24
-
-
Save aledujke/2023782 to your computer and use it in GitHub Desktop.
Revisions
-
aledujke revised this gist
Apr 19, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ class sfWidgetFormSchemaFormatterBootstrap extends sfWidgetFormSchemaFormatter $errorRowFormatInARow = "%error% ", $namedErrorRowFormatInARow = "%name%: %error% ", $helpFormat = '<p class="help-block">%help%</p>', $decoratorFormat = '%content%'; public function formatRow($label, $field, $errors = array(), $help = '', $hiddenFields = null) { -
aledujke revised this gist
Mar 12, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public function formatRow($label, $field, $errors = array(), $help = '', $hidden ); return strtr($row, array( '%row_class%' => count($errors) ? ' error' : '', )); } -
aledujke revised this gist
Mar 12, 2012 . 1 changed file with 15 additions and 8 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,19 +1,13 @@ <?php class sfWidgetFormSchemaFormatterBootstrap extends sfWidgetFormSchemaFormatter { protected $rowFormat = "<div class=\"control-group %row_class%\">\n %label%\n <div class=\"controls\">\n %field%\n %error%\n %help%\n %hidden_fields%\n </div>\n</div>\n", $errorRowFormat = '%errors%', $errorListFormatInARow = "<span class=\"help-inline\">%errors%</span>\n", $errorRowFormatInARow = "%error% ", $namedErrorRowFormatInARow = "%name%: %error% ", $helpFormat = '<p class="help-block">%help%</p>', $decoratorFormat = ''; public function formatRow($label, $field, $errors = array(), $help = '', $hiddenFields = null) @@ -30,4 +24,17 @@ public function formatRow($label, $field, $errors = array(), $help = '', $hidden '%row_class%' => (count($errors) > 0) ? ' error' : '', )); } public function generateLabel($name, $attributes = array()) { if(isset($attributes['class'])) { $attributes['class'] .= ' control-label'; } else { $attributes['class'] = 'control-label'; } return parent::generateLabel($name, $attributes); } } -
malteo created this gist
Nov 11, 2011 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ <?php /** * A FormSchemaFormatter to use with Twitter Bootstrap CSS. * * @author malteo */ class sfWidgetFormSchemaFormatterBootstrap extends sfWidgetFormSchemaFormatter { protected $rowFormat = "<div class=\"clearfix%row_class%\">\n %label%\n <div class=\"input\">\n %field%\n %error%\n %help%\n %hidden_fields%\n </div>\n</div>\n", $errorRowFormat = '%errors%', $errorListFormatInARow = "<span class=\"help-inline\">%errors%</span>\n", $errorRowFormatInARow = "%error% ", $namedErrorRowFormatInARow = "%name%: %error% ", $helpFormat = '<span class="help-block">%help%</span>', $decoratorFormat = ''; public function formatRow($label, $field, $errors = array(), $help = '', $hiddenFields = null) { $row = parent::formatRow( $label, $field, $errors, $help, $hiddenFields ); return strtr($row, array( '%row_class%' => (count($errors) > 0) ? ' error' : '', )); } }