Updating helper method references, and fixing FormHelper::hidden() to work with '_method'

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4315 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2007-01-22 08:12:06 +00:00
parent 181a22d659
commit 9444538ec0
2 changed files with 9 additions and 3 deletions

View file

@ -129,7 +129,7 @@ class FormHelper extends AppHelper {
case 'post':
case 'put':
case 'delete':
$append .= $this->hidden('method/method', array('value' => up($options['type'])));
$append .= $this->hidden('_method', array('value' => up($options['type'])));
default:
$htmlAttributes['method'] = 'post';
break;
@ -387,7 +387,7 @@ class FormHelper extends AppHelper {
$out = $before . $out . $between . $this->{$type}($tagName, $options);
break;
case 'file':
$out = $before . $out . $between . $this->Html->file($tagName);
$out = $before . $out . $between . $this->file($tagName);
break;
case 'select':
$options = am(array('options' => array()), $options);
@ -488,7 +488,12 @@ class FormHelper extends AppHelper {
*/
function hidden($fieldName, $htmlAttributes = array()) {
$htmlAttributes = $this->domId($this->__value($htmlAttributes, $fieldName));
return $this->output(sprintf($this->Html->tags['hidden'], $this->model(), $this->field(), $this->_parseAttributes($htmlAttributes, null, ' ', ' ')));
$model = $this->model();
if (in_array($fieldName, array('_method'))) {
$model = null;
unset($htmlAttributes['id']);
}
return $this->output(sprintf($this->Html->tags['hidden'], $model, $this->field(), $this->_parseAttributes($htmlAttributes, null, ' ', ' ')));
}
/**
* Creates file input widget.

View file

@ -418,6 +418,7 @@ class HtmlHelper extends AppHelper {
* @return string
*/
function file($fieldName, $htmlAttributes = array()) {
trigger_error(__('(HtmlHelper::file) Deprecated: Use FormHelper::file instead'), E_USER_WARNING);
if (strpos($fieldName, '/')) {
$this->setFormTag($fieldName);
$htmlAttributes = $this->domId($htmlAttributes);