Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding some missing documentation and cleaning up code inside FormHel…

…per::select().
  • Loading branch information...
commit 61864a3b766d56191d02bd28299a7f634c6602c7 1 parent c35ef7d
@markstory markstory authored
Showing with 14 additions and 19 deletions.
  1. +14 −19 cake/libs/view/helpers/form.php
View
33 cake/libs/view/helpers/form.php
@@ -1381,6 +1381,7 @@ function submit($caption = null, $options = array()) {
* - `empty` - If true, the empty select option is shown. If a string,
* that string is displayed as the empty element.
* - `escape` - If true contents of options will be HTML entity encoded. Defaults to true.
+ * - `class` - When using multiple = checkbox the classname to apply to the divs. Defaults to 'checkbox'.
*
* ### Using options
*
@@ -1418,27 +1419,25 @@ function submit($caption = null, $options = array()) {
*/
function select($fieldName, $options = array(), $selected = null, $attributes = array()) {
$select = array();
- $showParents = false;
- $escapeOptions = true;
$style = null;
$tag = null;
- $showEmpty = '';
+ $attributes += array(
+ 'class' => null,
+ 'escape' => true,
+ 'secure' => null,
+ 'empty' => '',
+ 'showParents' => false
+ );
+
+ $escapeOptions = $this->_extractOption('escape', $attributes);
+ $secure = $this->_extractOption('secure', $attributes);
+ $showEmpty = $this->_extractOption('empty', $attributes);
+ $showParents = $this->_extractOption('showParents', $attributes);
+ unset($attributes['escape'], $attributes['secure'], $attributes['empty'], $attributes['showParents']);
- if (isset($attributes['escape'])) {
- $escapeOptions = $attributes['escape'];
- unset($attributes['escape']);
- }
- if (isset($attributes['secure'])) {
- $secure = $attributes['secure'];
- }
- if (isset($attributes['empty'])) {
- $showEmpty = $attributes['empty'];
- unset($attributes['empty']);
- }
$attributes = $this->_initInputField($fieldName, array_merge(
(array)$attributes, array('secure' => false)
));
- $attributes += array('class' => null);
if (is_string($options) && isset($this->__options[$options])) {
$options = $this->__generateOptions($options);
@@ -1448,10 +1447,6 @@ function select($fieldName, $options = array(), $selected = null, $attributes =
if (isset($attributes['type'])) {
unset($attributes['type']);
}
- if (in_array('showParents', $attributes)) {
- $showParents = true;
- unset($attributes['showParents']);
- }
if (!isset($selected)) {
$selected = $attributes['value'];
Please sign in to comment.
Something went wrong with that request. Please try again.