Permalink
Browse files

Adding documentation on 'attributes' key for FormHelper::error

  • Loading branch information...
lorenzo committed Apr 20, 2010
1 parent 23eea00 commit e1c4b9696b22963761c1b72b93d01c9a4c81cabd
Showing with 5 additions and 4 deletions.
  1. +4 −3 cake/libs/view/helpers/form.php
  2. +1 −1 cake/tests/cases/libs/view/helpers/form.test.php
@@ -469,7 +469,8 @@ function isFieldError($field) {
* - `class` string The classname for the error message
*
* @param string $field A field name, like "Modelname.fieldname"
- * @param mixed $text Error message or array of $options
+ * @param mixed $text Error message or array of $options. If array, `attributes` key
+ * will get used as html attributes for error container
* @param array $options Rendering options for <div /> wrapper tag
* @return string If there are errors this method returns an error message, otherwise null.
* @access public
@@ -499,7 +500,7 @@ function error($field, $text = null, $options = array()) {
$options = array_merge($options, $text['attributes']);
}
$text = isset($text[$error]) ? $text[$error] : null;
- unset($options[$error]);
+ unset($options[$error]);
}
if ($text != null) {
@@ -1458,7 +1459,7 @@ function select($fieldName, $options = array(), $selected = null, $attributes =
}
if (!empty($tag) || isset($template)) {
- if (!isset($secure) || $secure == true) {
+ if (!isset($secure) || $secure == true) {
$this->__secure();
}
$select[] = sprintf($tag, $attributes['name'], $this->_parseAttributes(
@@ -3307,7 +3307,7 @@ function testSelectMultipleCheckboxes() {
'first',
'/label',
'/div',
-
+
array('div' => array('class' => 'checkbox')),
array('input' => array(
'type' => 'checkbox', 'name' => 'data[Model][tags][]',

0 comments on commit e1c4b96

Please sign in to comment.