From b183501e8520cb40a23305577f8cdf19d1acfe27 Mon Sep 17 00:00:00 2001 From: phpnut Date: Sat, 17 Mar 2007 07:58:22 +0000 Subject: [PATCH] Adding changes needed to allow passing $tagName param using dot notation so use Model.field instead of Model/field which is being deprecated git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4630 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/view/helper.php | 9 +++++++-- cake/libs/view/helpers/form.php | 22 +++++++++++----------- cake/libs/view/helpers/html.php | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/cake/libs/view/helper.php b/cake/libs/view/helper.php index e8432bc18..9b69c3334 100644 --- a/cake/libs/view/helper.php +++ b/cake/libs/view/helper.php @@ -310,11 +310,16 @@ class Helper extends Overloadable { /** * Sets this helper's model and field properties to the slash-separated value-pair in $tagValue. * - * @param string $tagValue A field name, like "Modelname/fieldname" + * @param string $tagValue A field name, like "Modelname.fieldname", "Modelname/fieldname" is deprecated */ function setFormTag($tagValue) { $view =& ClassRegistry::getObject('view'); - $parts = explode("/", $tagValue); + + if(strpos($tagValue, '.') !== false) { + $parts = explode(".", $tagValue); + } else { + $parts = explode("/", $tagValue); + } if (count($parts) == 1) { $view->field = $parts[0]; diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index c56b8c6b9..ca5ce7554 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -99,7 +99,7 @@ class FormHelper extends AppHelper { } } - $this->setFormTag($model . '/'); + $this->setFormTag($model . '.'); $append = ''; $created = $id = false; @@ -179,7 +179,7 @@ class FormHelper extends AppHelper { $append .= $this->hidden('_Token/key', array('value' => $this->params['_Token']['key'], 'id' => $options['id'] . 'Token')); } - $this->setFormTag($model . '/'); + $this->setFormTag($model . '.'); return $this->output(sprintf($this->Html->tags['form'], $this->Html->parseHtmlOptions($htmlAttributes, null, ''))) . $append; } /** @@ -198,7 +198,7 @@ class FormHelper extends AppHelper { * Returns true if there is an error for the given field, otherwise false * * @access public - * @param string $field This should be "Modelname/fieldname" + * @param string $field This should be "Modelname.fieldname", "Modelname/fieldname" is deprecated * @return bool If there are errors this method returns true, else false. */ function isFieldError($field) { @@ -208,7 +208,7 @@ class FormHelper extends AppHelper { /** * Returns a formatted error message for given FORM field, NULL if no errors. * - * @param string $field A field name, like "Modelname/fieldname" + * @param string $field A field name, like "Modelname.fieldname", "Modelname/fieldname" is deprecated * @param string $text Error message * @param array $options Rendering options for
wrapper tag * @return string If there are errors this method returns an error message, otherwise null. @@ -230,7 +230,7 @@ class FormHelper extends AppHelper { /** * Returns a formatted LABEL element for HTML FORMs. * - * @param string $tagName This should be "Modelname/fieldname" + * @param string $tagName This should be "Modelname.fieldname", "Modelname/fieldname" is deprecated * @param string $text Text that will appear in the label field. * @return string The formatted LABEL element */ @@ -281,7 +281,7 @@ class FormHelper extends AppHelper { /** * Generates a form input element complete with label and wrapper div * - * @param string $tagName This should be "Modelname/fieldname" + * @param string $tagName This should be "Modelname.fieldname", "Modelname/fieldname" is deprecated * @param array $options * @return string */ @@ -442,7 +442,7 @@ class FormHelper extends AppHelper { /** * Creates a text input widget. * - * @param string $fieldNamem Name of a field, like this "Modelname/fieldname" + * @param string $fieldNamem Name of a field, like this "Modelname.fieldname", "Modelname/fieldname" is deprecated * @param array $htmlAttributes Array of HTML attributes. * @return string An HTML text input element */ @@ -459,7 +459,7 @@ class FormHelper extends AppHelper { /** * Creates a password input widget. * - * @param string $fieldName Name of a field, like this "Modelname/fieldname" + * @param string $fieldName Name of a field, like this "Modelname.fieldname", "Modelname/fieldname" is deprecated * @param array $htmlAttributes Array of HTML attributes. * @return string */ @@ -474,7 +474,7 @@ class FormHelper extends AppHelper { /** * Creates a textarea widget. * - * @param string $fieldNamem Name of a field, like this "Modelname/fieldname" + * @param string $fieldNamem Name of a field, like this "Modelname.fieldname", "Modelname/fieldname" is deprecated * @param array $htmlAttributes Array of HTML attributes. * @return string An HTML text input element */ @@ -498,7 +498,7 @@ class FormHelper extends AppHelper { /** * Creates a hidden input field. * - * @param string $fieldName Name of a field, like this "Modelname/fieldname" + * @param string $fieldName Name of a field, like this "Modelname.fieldname", "Modelname/fieldname" is deprecated * @param array $htmlAttributes Array of HTML attributes. * @return string * @access public @@ -514,7 +514,7 @@ class FormHelper extends AppHelper { /** * Creates file input widget. * - * @param string $fieldName Name of a field, like this "Modelname/fieldname" + * @param string $fieldName Name of a field, like this "Modelname.fieldname", "Modelname/fieldname" is deprecated * @param array $htmlAttributes Array of HTML attributes. * @return string * @access public diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index c33839eff..d3a18dbcd 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -560,7 +560,7 @@ class HtmlHelper extends AppHelper { /** * Returns value of $fieldName. False if the tag does not exist. * - * @param string $fieldName Fieldname as "Modelname/fieldname" string + * @param string $fieldName Name of a field, like this "Modelname.fieldname", "Modelname/fieldname" is deprecated * @return unknown Value of the named tag. */ function tagValue($fieldName) {