Fixing URLs in HtmlHelper::meta(), and moving textarea() to FormHelper

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3427 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2006-08-22 19:35:08 +00:00
parent cdb11b2ba2
commit 4f53c301a8
2 changed files with 28 additions and 2 deletions

View file

@ -139,7 +139,7 @@ class FormHelper extends Helper {
$this->Html->setFormTag($fieldName);
if (!isset($htmlAttributes['value'])) {
$htmlAttributes['value'] = $this->tagValue($fieldName);
$htmlAttributes['value'] = $this->Html->tagValue($fieldName);
}
if (!isset($htmlAttributes['type'])) {
@ -160,6 +160,32 @@ class FormHelper extends Helper {
return sprintf($this->tags['input'], $this->Html->model, $this->Html->field, $this->Html->_parseAttributes($htmlAttributes, null, ' ', ' '));
}
/**
* Creates a textarea widget.
*
* @param string $fieldNamem Name of a field, like this "Modelname/fieldname"
* @param array $htmlAttributes Array of HTML attributes.
* @return string An HTML text input element
*/
function textarea($fieldName, $htmlAttributes = null) {
$value = $this->Html->tagValue($fieldName);
if (!empty($htmlAttributes['value'])) {
$value = $htmlAttributes['value'];
unset($htmlAttributes['value']);
}
if (!isset($htmlAttributes['id'])) {
$htmlAttributes['id'] = $this->Html->model . Inflector::camelize($this->Html->field);
}
if ($this->Html->tagIsInvalid($this->Html->model, $this->Html->field)) {
if (isset($htmlAttributes['class']) && trim($htmlAttributes['class']) != "") {
$htmlAttributes['class'] .= ' form_error';
} else {
$htmlAttributes['class'] = 'form_error';
}
}
return $this->output(sprintf($this->tags['textarea'], $this->Html->model, $this->Html->field, $this->Html->_parseAttributes($htmlAttributes, null, ' '), $value));
}
/**
* Creates a button tag.
*

View file

@ -168,7 +168,7 @@ class HtmlHelper extends Helper {
if (!isset($attributes['rel'])) {
$attributes['rel'] = 'alternate';
}
return $this->output(sprintf($this->tags['metalink'], $this->url($url), $title, $this->_parseAttributes($attributes)));
return $this->output(sprintf($this->tags['metalink'], $this->url($url, true), $title, $this->_parseAttributes($attributes)));
}
/**
* Returns a charset META-tag.