@@ -1,217 +1,217 @@ |
||
| 1 | 1 | <?php return array( |
| 2 | 2 | |
| 3 | - // Markup |
|
| 4 | - //////////////////////////////////////////////////////////////////// |
|
| 5 | - |
|
| 6 | - // Whether labels should be automatically computed from name |
|
| 7 | - 'automatic_label' => true, |
|
| 8 | - |
|
| 9 | - // The default form type |
|
| 10 | - 'default_form_type' => 'horizontal', |
|
| 11 | - |
|
| 12 | - // Whether Former should escape HTML tags of 'plaintext' fields value |
|
| 13 | - // Enabled by default |
|
| 14 | - // |
|
| 15 | - // Instead of disabled this option, you should use the 'HtmlString' class: |
|
| 16 | - // Former::plaintext('text') |
|
| 17 | - // ->forceValue( |
|
| 18 | - // new Illuminate\Support\HtmlString('<b>your HTML data</b>') |
|
| 19 | - // ) |
|
| 20 | - 'escape_plaintext_value' => true, |
|
| 21 | - |
|
| 22 | - // Validation |
|
| 23 | - //////////////////////////////////////////////////////////////////// |
|
| 24 | - |
|
| 25 | - // Whether Former should fetch errors from Session |
|
| 26 | - 'fetch_errors' => true, |
|
| 27 | - |
|
| 28 | - // Whether Former should try to apply Validator rules as attributes |
|
| 29 | - 'live_validation' => true, |
|
| 30 | - |
|
| 31 | - // Whether Former should automatically fetch error messages and |
|
| 32 | - // display them next to the matching fields |
|
| 33 | - 'error_messages' => true, |
|
| 34 | - |
|
| 35 | - // Checkables |
|
| 36 | - //////////////////////////////////////////////////////////////////// |
|
| 37 | - |
|
| 38 | - // Whether checkboxes should always be present in the POST data, |
|
| 39 | - // no matter if you checked them or not |
|
| 40 | - 'push_checkboxes' => false, |
|
| 41 | - |
|
| 42 | - // The value a checkbox will have in the POST array if unchecked |
|
| 43 | - 'unchecked_value' => 0, |
|
| 44 | - |
|
| 45 | - // Required fields |
|
| 46 | - //////////////////////////////////////////////////////////////////// |
|
| 47 | - |
|
| 48 | - // The class to be added to required fields |
|
| 49 | - 'required_class' => 'required', |
|
| 50 | - |
|
| 51 | - // A facultative text to append to the labels of required fields |
|
| 52 | - 'required_text' => '<sup>*</sup>', |
|
| 53 | - |
|
| 54 | - // Translations |
|
| 55 | - //////////////////////////////////////////////////////////////////// |
|
| 56 | - |
|
| 57 | - // Where Former should look for translations |
|
| 58 | - 'translate_from' => 'validation.attributes', |
|
| 59 | - |
|
| 60 | - // Whether text that comes out of the translated |
|
| 61 | - // should be capitalized (ex: email => Email) automatically |
|
| 62 | - 'capitalize_translations' => true, |
|
| 63 | - |
|
| 64 | - // An array of attributes to automatically translate |
|
| 65 | - 'translatable' => array( |
|
| 66 | - 'help', |
|
| 67 | - 'inlineHelp', |
|
| 68 | - 'blockHelp', |
|
| 69 | - 'placeholder', |
|
| 70 | - 'data_placeholder', |
|
| 71 | - 'label', |
|
| 72 | - ), |
|
| 73 | - |
|
| 74 | - // Framework |
|
| 75 | - //////////////////////////////////////////////////////////////////// |
|
| 76 | - |
|
| 77 | - // The framework to be used by Former |
|
| 78 | - 'framework' => 'TwitterBootstrap3', |
|
| 79 | - |
|
| 80 | - 'TwitterBootstrap4' => array( |
|
| 81 | - |
|
| 82 | - // Map Former-supported viewports to Bootstrap 4 equivalents |
|
| 83 | - 'viewports' => array( |
|
| 84 | - 'large' => 'lg', |
|
| 85 | - 'medium' => 'md', |
|
| 86 | - 'small' => 'sm', |
|
| 87 | - 'mini' => 'xs', |
|
| 88 | - ), |
|
| 89 | - // Width of labels for horizontal forms expressed as viewport => grid columns |
|
| 90 | - 'labelWidths' => array( |
|
| 91 | - 'large' => 2, |
|
| 92 | - 'small' => 4, |
|
| 93 | - ), |
|
| 94 | - // HTML markup and classes used by Bootstrap 5 for icons |
|
| 95 | - 'icon' => array( |
|
| 96 | - 'tag' => 'i', |
|
| 97 | - 'set' => 'fa', |
|
| 98 | - 'prefix' => 'fa', |
|
| 99 | - ), |
|
| 100 | - |
|
| 101 | - ), |
|
| 102 | - |
|
| 103 | - 'TwitterBootstrap3' => array( |
|
| 104 | - |
|
| 105 | - // Map Former-supported viewports to Bootstrap 3 equivalents |
|
| 106 | - 'viewports' => array( |
|
| 107 | - 'large' => 'lg', |
|
| 108 | - 'medium' => 'md', |
|
| 109 | - 'small' => 'sm', |
|
| 110 | - 'mini' => 'xs', |
|
| 111 | - ), |
|
| 112 | - // Width of labels for horizontal forms expressed as viewport => grid columns |
|
| 113 | - 'labelWidths' => array( |
|
| 114 | - 'large' => 2, |
|
| 115 | - 'small' => 4, |
|
| 116 | - ), |
|
| 117 | - // HTML markup and classes used by Bootstrap 3 for icons |
|
| 118 | - 'icon' => array( |
|
| 119 | - 'tag' => 'span', |
|
| 120 | - 'set' => 'glyphicon', |
|
| 121 | - 'prefix' => 'glyphicon', |
|
| 122 | - ), |
|
| 123 | - |
|
| 124 | - ), |
|
| 125 | - |
|
| 126 | - 'Nude' => array( // No-framework markup |
|
| 127 | - 'icon' => array( |
|
| 128 | - 'tag' => 'i', |
|
| 129 | - 'set' => null, |
|
| 130 | - 'prefix' => 'icon', |
|
| 131 | - ), |
|
| 132 | - ), |
|
| 133 | - |
|
| 134 | - 'TwitterBootstrap' => array( // Twitter Bootstrap version 2 |
|
| 135 | - 'icon' => array( |
|
| 136 | - 'tag' => 'i', |
|
| 137 | - 'set' => null, |
|
| 138 | - 'prefix' => 'icon', |
|
| 139 | - ), |
|
| 140 | - ), |
|
| 141 | - |
|
| 142 | - 'ZurbFoundation5' => array( |
|
| 143 | - // Map Former-supported viewports to Foundation 5 equivalents |
|
| 144 | - 'viewports' => array( |
|
| 145 | - 'large' => 'large', |
|
| 146 | - 'medium' => null, |
|
| 147 | - 'small' => 'small', |
|
| 148 | - 'mini' => null, |
|
| 149 | - ), |
|
| 150 | - // Width of labels for horizontal forms expressed as viewport => grid columns |
|
| 151 | - 'labelWidths' => array( |
|
| 152 | - 'small' => 3, |
|
| 153 | - ), |
|
| 154 | - // Classes to be applied to wrapped labels in horizontal forms |
|
| 155 | - 'wrappedLabelClasses' => array('right', 'inline'), |
|
| 156 | - // HTML markup and classes used by Foundation 5 for icons |
|
| 157 | - 'icon' => array( |
|
| 158 | - 'tag' => 'i', |
|
| 159 | - 'set' => null, |
|
| 160 | - 'prefix' => 'fi', |
|
| 161 | - ), |
|
| 162 | - // CSS for inline validation errors |
|
| 163 | - 'error_classes' => array('class' => 'error'), |
|
| 164 | - ), |
|
| 165 | - |
|
| 166 | - 'ZurbFoundation4' => array( |
|
| 167 | - // Foundation 4 also has an experimental "medium" breakpoint |
|
| 168 | - // explained at http://foundation.zurb.com/docs/components/grid.html |
|
| 169 | - 'viewports' => array( |
|
| 170 | - 'large' => 'large', |
|
| 171 | - 'medium' => null, |
|
| 172 | - 'small' => 'small', |
|
| 173 | - 'mini' => null, |
|
| 174 | - ), |
|
| 175 | - // Width of labels for horizontal forms expressed as viewport => grid columns |
|
| 176 | - 'labelWidths' => array( |
|
| 177 | - 'small' => 3, |
|
| 178 | - ), |
|
| 179 | - // Classes to be applied to wrapped labels in horizontal forms |
|
| 180 | - 'wrappedLabelClasses' => array('right', 'inline'), |
|
| 181 | - // HTML markup and classes used by Foundation 4 for icons |
|
| 182 | - 'icon' => array( |
|
| 183 | - 'tag' => 'i', |
|
| 184 | - 'set' => 'general', |
|
| 185 | - 'prefix' => 'foundicon', |
|
| 186 | - ), |
|
| 187 | - // CSS for inline validation errors |
|
| 188 | - 'error_classes' => array('class' => 'alert-box radius warning'), |
|
| 189 | - ), |
|
| 190 | - |
|
| 191 | - 'ZurbFoundation' => array( // Foundation 3 |
|
| 192 | - 'viewports' => array( |
|
| 193 | - 'large' => '', |
|
| 194 | - 'medium' => null, |
|
| 195 | - 'small' => 'mobile-', |
|
| 196 | - 'mini' => null, |
|
| 197 | - ), |
|
| 198 | - // Width of labels for horizontal forms expressed as viewport => grid columns |
|
| 199 | - 'labelWidths' => array( |
|
| 200 | - 'large' => 2, |
|
| 201 | - 'small' => 4, |
|
| 202 | - ), |
|
| 203 | - // Classes to be applied to wrapped labels in horizontal forms |
|
| 204 | - 'wrappedLabelClasses' => array('right', 'inline'), |
|
| 205 | - // HTML markup and classes used by Foundation 3 for icons |
|
| 206 | - 'icon' => array( |
|
| 207 | - 'tag' => 'i', |
|
| 208 | - 'set' => null, |
|
| 209 | - 'prefix' => 'fi', |
|
| 210 | - ), |
|
| 211 | - // CSS for inline validation errors |
|
| 212 | - // should work for Zurb 2 and 3 |
|
| 213 | - 'error_classes' => array('class' => 'alert-box alert error'), |
|
| 214 | - ), |
|
| 3 | + // Markup |
|
| 4 | + //////////////////////////////////////////////////////////////////// |
|
| 5 | + |
|
| 6 | + // Whether labels should be automatically computed from name |
|
| 7 | + 'automatic_label' => true, |
|
| 8 | + |
|
| 9 | + // The default form type |
|
| 10 | + 'default_form_type' => 'horizontal', |
|
| 11 | + |
|
| 12 | + // Whether Former should escape HTML tags of 'plaintext' fields value |
|
| 13 | + // Enabled by default |
|
| 14 | + // |
|
| 15 | + // Instead of disabled this option, you should use the 'HtmlString' class: |
|
| 16 | + // Former::plaintext('text') |
|
| 17 | + // ->forceValue( |
|
| 18 | + // new Illuminate\Support\HtmlString('<b>your HTML data</b>') |
|
| 19 | + // ) |
|
| 20 | + 'escape_plaintext_value' => true, |
|
| 21 | + |
|
| 22 | + // Validation |
|
| 23 | + //////////////////////////////////////////////////////////////////// |
|
| 24 | + |
|
| 25 | + // Whether Former should fetch errors from Session |
|
| 26 | + 'fetch_errors' => true, |
|
| 27 | + |
|
| 28 | + // Whether Former should try to apply Validator rules as attributes |
|
| 29 | + 'live_validation' => true, |
|
| 30 | + |
|
| 31 | + // Whether Former should automatically fetch error messages and |
|
| 32 | + // display them next to the matching fields |
|
| 33 | + 'error_messages' => true, |
|
| 34 | + |
|
| 35 | + // Checkables |
|
| 36 | + //////////////////////////////////////////////////////////////////// |
|
| 37 | + |
|
| 38 | + // Whether checkboxes should always be present in the POST data, |
|
| 39 | + // no matter if you checked them or not |
|
| 40 | + 'push_checkboxes' => false, |
|
| 41 | + |
|
| 42 | + // The value a checkbox will have in the POST array if unchecked |
|
| 43 | + 'unchecked_value' => 0, |
|
| 44 | + |
|
| 45 | + // Required fields |
|
| 46 | + //////////////////////////////////////////////////////////////////// |
|
| 47 | + |
|
| 48 | + // The class to be added to required fields |
|
| 49 | + 'required_class' => 'required', |
|
| 50 | + |
|
| 51 | + // A facultative text to append to the labels of required fields |
|
| 52 | + 'required_text' => '<sup>*</sup>', |
|
| 53 | + |
|
| 54 | + // Translations |
|
| 55 | + //////////////////////////////////////////////////////////////////// |
|
| 56 | + |
|
| 57 | + // Where Former should look for translations |
|
| 58 | + 'translate_from' => 'validation.attributes', |
|
| 59 | + |
|
| 60 | + // Whether text that comes out of the translated |
|
| 61 | + // should be capitalized (ex: email => Email) automatically |
|
| 62 | + 'capitalize_translations' => true, |
|
| 63 | + |
|
| 64 | + // An array of attributes to automatically translate |
|
| 65 | + 'translatable' => array( |
|
| 66 | + 'help', |
|
| 67 | + 'inlineHelp', |
|
| 68 | + 'blockHelp', |
|
| 69 | + 'placeholder', |
|
| 70 | + 'data_placeholder', |
|
| 71 | + 'label', |
|
| 72 | + ), |
|
| 73 | + |
|
| 74 | + // Framework |
|
| 75 | + //////////////////////////////////////////////////////////////////// |
|
| 76 | + |
|
| 77 | + // The framework to be used by Former |
|
| 78 | + 'framework' => 'TwitterBootstrap3', |
|
| 79 | + |
|
| 80 | + 'TwitterBootstrap4' => array( |
|
| 81 | + |
|
| 82 | + // Map Former-supported viewports to Bootstrap 4 equivalents |
|
| 83 | + 'viewports' => array( |
|
| 84 | + 'large' => 'lg', |
|
| 85 | + 'medium' => 'md', |
|
| 86 | + 'small' => 'sm', |
|
| 87 | + 'mini' => 'xs', |
|
| 88 | + ), |
|
| 89 | + // Width of labels for horizontal forms expressed as viewport => grid columns |
|
| 90 | + 'labelWidths' => array( |
|
| 91 | + 'large' => 2, |
|
| 92 | + 'small' => 4, |
|
| 93 | + ), |
|
| 94 | + // HTML markup and classes used by Bootstrap 5 for icons |
|
| 95 | + 'icon' => array( |
|
| 96 | + 'tag' => 'i', |
|
| 97 | + 'set' => 'fa', |
|
| 98 | + 'prefix' => 'fa', |
|
| 99 | + ), |
|
| 100 | + |
|
| 101 | + ), |
|
| 102 | + |
|
| 103 | + 'TwitterBootstrap3' => array( |
|
| 104 | + |
|
| 105 | + // Map Former-supported viewports to Bootstrap 3 equivalents |
|
| 106 | + 'viewports' => array( |
|
| 107 | + 'large' => 'lg', |
|
| 108 | + 'medium' => 'md', |
|
| 109 | + 'small' => 'sm', |
|
| 110 | + 'mini' => 'xs', |
|
| 111 | + ), |
|
| 112 | + // Width of labels for horizontal forms expressed as viewport => grid columns |
|
| 113 | + 'labelWidths' => array( |
|
| 114 | + 'large' => 2, |
|
| 115 | + 'small' => 4, |
|
| 116 | + ), |
|
| 117 | + // HTML markup and classes used by Bootstrap 3 for icons |
|
| 118 | + 'icon' => array( |
|
| 119 | + 'tag' => 'span', |
|
| 120 | + 'set' => 'glyphicon', |
|
| 121 | + 'prefix' => 'glyphicon', |
|
| 122 | + ), |
|
| 123 | + |
|
| 124 | + ), |
|
| 125 | + |
|
| 126 | + 'Nude' => array( // No-framework markup |
|
| 127 | + 'icon' => array( |
|
| 128 | + 'tag' => 'i', |
|
| 129 | + 'set' => null, |
|
| 130 | + 'prefix' => 'icon', |
|
| 131 | + ), |
|
| 132 | + ), |
|
| 133 | + |
|
| 134 | + 'TwitterBootstrap' => array( // Twitter Bootstrap version 2 |
|
| 135 | + 'icon' => array( |
|
| 136 | + 'tag' => 'i', |
|
| 137 | + 'set' => null, |
|
| 138 | + 'prefix' => 'icon', |
|
| 139 | + ), |
|
| 140 | + ), |
|
| 141 | + |
|
| 142 | + 'ZurbFoundation5' => array( |
|
| 143 | + // Map Former-supported viewports to Foundation 5 equivalents |
|
| 144 | + 'viewports' => array( |
|
| 145 | + 'large' => 'large', |
|
| 146 | + 'medium' => null, |
|
| 147 | + 'small' => 'small', |
|
| 148 | + 'mini' => null, |
|
| 149 | + ), |
|
| 150 | + // Width of labels for horizontal forms expressed as viewport => grid columns |
|
| 151 | + 'labelWidths' => array( |
|
| 152 | + 'small' => 3, |
|
| 153 | + ), |
|
| 154 | + // Classes to be applied to wrapped labels in horizontal forms |
|
| 155 | + 'wrappedLabelClasses' => array('right', 'inline'), |
|
| 156 | + // HTML markup and classes used by Foundation 5 for icons |
|
| 157 | + 'icon' => array( |
|
| 158 | + 'tag' => 'i', |
|
| 159 | + 'set' => null, |
|
| 160 | + 'prefix' => 'fi', |
|
| 161 | + ), |
|
| 162 | + // CSS for inline validation errors |
|
| 163 | + 'error_classes' => array('class' => 'error'), |
|
| 164 | + ), |
|
| 165 | + |
|
| 166 | + 'ZurbFoundation4' => array( |
|
| 167 | + // Foundation 4 also has an experimental "medium" breakpoint |
|
| 168 | + // explained at http://foundation.zurb.com/docs/components/grid.html |
|
| 169 | + 'viewports' => array( |
|
| 170 | + 'large' => 'large', |
|
| 171 | + 'medium' => null, |
|
| 172 | + 'small' => 'small', |
|
| 173 | + 'mini' => null, |
|
| 174 | + ), |
|
| 175 | + // Width of labels for horizontal forms expressed as viewport => grid columns |
|
| 176 | + 'labelWidths' => array( |
|
| 177 | + 'small' => 3, |
|
| 178 | + ), |
|
| 179 | + // Classes to be applied to wrapped labels in horizontal forms |
|
| 180 | + 'wrappedLabelClasses' => array('right', 'inline'), |
|
| 181 | + // HTML markup and classes used by Foundation 4 for icons |
|
| 182 | + 'icon' => array( |
|
| 183 | + 'tag' => 'i', |
|
| 184 | + 'set' => 'general', |
|
| 185 | + 'prefix' => 'foundicon', |
|
| 186 | + ), |
|
| 187 | + // CSS for inline validation errors |
|
| 188 | + 'error_classes' => array('class' => 'alert-box radius warning'), |
|
| 189 | + ), |
|
| 190 | + |
|
| 191 | + 'ZurbFoundation' => array( // Foundation 3 |
|
| 192 | + 'viewports' => array( |
|
| 193 | + 'large' => '', |
|
| 194 | + 'medium' => null, |
|
| 195 | + 'small' => 'mobile-', |
|
| 196 | + 'mini' => null, |
|
| 197 | + ), |
|
| 198 | + // Width of labels for horizontal forms expressed as viewport => grid columns |
|
| 199 | + 'labelWidths' => array( |
|
| 200 | + 'large' => 2, |
|
| 201 | + 'small' => 4, |
|
| 202 | + ), |
|
| 203 | + // Classes to be applied to wrapped labels in horizontal forms |
|
| 204 | + 'wrappedLabelClasses' => array('right', 'inline'), |
|
| 205 | + // HTML markup and classes used by Foundation 3 for icons |
|
| 206 | + 'icon' => array( |
|
| 207 | + 'tag' => 'i', |
|
| 208 | + 'set' => null, |
|
| 209 | + 'prefix' => 'fi', |
|
| 210 | + ), |
|
| 211 | + // CSS for inline validation errors |
|
| 212 | + // should work for Zurb 2 and 3 |
|
| 213 | + 'error_classes' => array('class' => 'alert-box alert error'), |
|
| 214 | + ), |
|
| 215 | 215 | |
| 216 | 216 | |
| 217 | 217 | ); |
@@ -9,31 +9,31 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class Plaintext extends Field |
| 11 | 11 | { |
| 12 | - //////////////////////////////////////////////////////////////////// |
|
| 13 | - /////////////////////////// CORE METHODS /////////////////////////// |
|
| 14 | - //////////////////////////////////////////////////////////////////// |
|
| 12 | + //////////////////////////////////////////////////////////////////// |
|
| 13 | + /////////////////////////// CORE METHODS /////////////////////////// |
|
| 14 | + //////////////////////////////////////////////////////////////////// |
|
| 15 | 15 | |
| 16 | - /** |
|
| 17 | - * Prints out the current tag |
|
| 18 | - * |
|
| 19 | - * @return string A plain text tag |
|
| 20 | - */ |
|
| 21 | - public function render() |
|
| 22 | - { |
|
| 23 | - $this->addClass($this->app['former.framework']->getPlainTextClasses()); |
|
| 24 | - $this->setId(); |
|
| 25 | - if ($this->app['former']->getOption('escape_plaintext_value', true)) { |
|
| 26 | - $this->escapeValue(); |
|
| 27 | - } |
|
| 16 | + /** |
|
| 17 | + * Prints out the current tag |
|
| 18 | + * |
|
| 19 | + * @return string A plain text tag |
|
| 20 | + */ |
|
| 21 | + public function render() |
|
| 22 | + { |
|
| 23 | + $this->addClass($this->app['former.framework']->getPlainTextClasses()); |
|
| 24 | + $this->setId(); |
|
| 25 | + if ($this->app['former']->getOption('escape_plaintext_value', true)) { |
|
| 26 | + $this->escapeValue(); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - return $this->app['former.framework']->createPlainTextField($this); |
|
| 30 | - } |
|
| 29 | + return $this->app['former.framework']->createPlainTextField($this); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - protected function escapeValue() |
|
| 33 | - { |
|
| 34 | - $valueToEscape = $this->getValue(); |
|
| 35 | - $value = is_string($valueToEscape) || $valueToEscape instanceof HtmlString ? e($valueToEscape) : $valueToEscape; |
|
| 32 | + protected function escapeValue() |
|
| 33 | + { |
|
| 34 | + $valueToEscape = $this->getValue(); |
|
| 35 | + $value = is_string($valueToEscape) || $valueToEscape instanceof HtmlString ? e($valueToEscape) : $valueToEscape; |
|
| 36 | 36 | |
| 37 | - return $this->forceValue($value); |
|
| 38 | - } |
|
| 37 | + return $this->forceValue($value); |
|
| 38 | + } |
|
| 39 | 39 | } |