Skip to content
Permalink
Browse files

Changing FormHelper::label() to allow param to be a string (class name)

  • Loading branch information...
nateabele committed Feb 9, 2009
1 parent c2f111a commit 519db5e2811aab38ec56ea48bc794233e828bfab
Showing with 5 additions and 1 deletion.
  1. +5 −1 cake/libs/view/helpers/form.php
@@ -435,7 +435,7 @@ function error($field, $text = null, $options = array()) {
*
* @param string $fieldName This should be "Modelname.fieldname"
* @param string $text Text that will appear in the label field.
* @param array $attributes Array of HTML attributes.
* @param Mixed $attributes An array of HTML attributes, or a string, to be used as a class name.
* @return string The formatted LABEL element
*/
function label($fieldName = null, $text = null, $attributes = array()) {
@@ -456,6 +456,10 @@ function label($fieldName = null, $text = null, $attributes = array()) {
$text = __(Inflector::humanize(Inflector::underscore($text)), true);
}
if (is_string($attributes)) {
$attributes = array('class' => $attributes);
}
if (isset($attributes['for'])) {
$labelFor = $attributes['for'];
unset($attributes['for']);

0 comments on commit 519db5e

Please sign in to comment.
You can’t perform that action at this time.