mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-07 12:36:25 +00:00
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
This commit is contained in:
parent
e1452240e1
commit
b183501e85
3 changed files with 19 additions and 14 deletions
|
@ -310,11 +310,16 @@ class Helper extends Overloadable {
|
||||||
/**
|
/**
|
||||||
* Sets this helper's model and field properties to the slash-separated value-pair in $tagValue.
|
* 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) {
|
function setFormTag($tagValue) {
|
||||||
$view =& ClassRegistry::getObject('view');
|
$view =& ClassRegistry::getObject('view');
|
||||||
$parts = explode("/", $tagValue);
|
|
||||||
|
if(strpos($tagValue, '.') !== false) {
|
||||||
|
$parts = explode(".", $tagValue);
|
||||||
|
} else {
|
||||||
|
$parts = explode("/", $tagValue);
|
||||||
|
}
|
||||||
|
|
||||||
if (count($parts) == 1) {
|
if (count($parts) == 1) {
|
||||||
$view->field = $parts[0];
|
$view->field = $parts[0];
|
||||||
|
|
|
@ -99,7 +99,7 @@ class FormHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setFormTag($model . '/');
|
$this->setFormTag($model . '.');
|
||||||
$append = '';
|
$append = '';
|
||||||
$created = $id = false;
|
$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'));
|
$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;
|
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
|
* Returns true if there is an error for the given field, otherwise false
|
||||||
*
|
*
|
||||||
* @access public
|
* @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.
|
* @return bool If there are errors this method returns true, else false.
|
||||||
*/
|
*/
|
||||||
function isFieldError($field) {
|
function isFieldError($field) {
|
||||||
|
@ -208,7 +208,7 @@ class FormHelper extends AppHelper {
|
||||||
/**
|
/**
|
||||||
* Returns a formatted error message for given FORM field, NULL if no errors.
|
* 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 string $text Error message
|
||||||
* @param array $options Rendering options for <div /> wrapper tag
|
* @param array $options Rendering options for <div /> wrapper tag
|
||||||
* @return string If there are errors this method returns an error message, otherwise null.
|
* @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.
|
* 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.
|
* @param string $text Text that will appear in the label field.
|
||||||
* @return string The formatted LABEL element
|
* @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
|
* 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
|
* @param array $options
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -442,7 +442,7 @@ class FormHelper extends AppHelper {
|
||||||
/**
|
/**
|
||||||
* Creates a text input widget.
|
* 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.
|
* @param array $htmlAttributes Array of HTML attributes.
|
||||||
* @return string An HTML text input element
|
* @return string An HTML text input element
|
||||||
*/
|
*/
|
||||||
|
@ -459,7 +459,7 @@ class FormHelper extends AppHelper {
|
||||||
/**
|
/**
|
||||||
* Creates a password input widget.
|
* 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.
|
* @param array $htmlAttributes Array of HTML attributes.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -474,7 +474,7 @@ class FormHelper extends AppHelper {
|
||||||
/**
|
/**
|
||||||
* Creates a textarea widget.
|
* 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.
|
* @param array $htmlAttributes Array of HTML attributes.
|
||||||
* @return string An HTML text input element
|
* @return string An HTML text input element
|
||||||
*/
|
*/
|
||||||
|
@ -498,7 +498,7 @@ class FormHelper extends AppHelper {
|
||||||
/**
|
/**
|
||||||
* Creates a hidden input field.
|
* 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.
|
* @param array $htmlAttributes Array of HTML attributes.
|
||||||
* @return string
|
* @return string
|
||||||
* @access public
|
* @access public
|
||||||
|
@ -514,7 +514,7 @@ class FormHelper extends AppHelper {
|
||||||
/**
|
/**
|
||||||
* Creates file input widget.
|
* 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.
|
* @param array $htmlAttributes Array of HTML attributes.
|
||||||
* @return string
|
* @return string
|
||||||
* @access public
|
* @access public
|
||||||
|
|
|
@ -560,7 +560,7 @@ class HtmlHelper extends AppHelper {
|
||||||
/**
|
/**
|
||||||
* Returns value of $fieldName. False if the tag does not exist.
|
* 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.
|
* @return unknown Value of the named tag.
|
||||||
*/
|
*/
|
||||||
function tagValue($fieldName) {
|
function tagValue($fieldName) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue