mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-01 23:29:45 +00:00
Transitioning to allow mulitple IDs in form inputs, and adding fix for Ticket #1468
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3607 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
c5befd7569
commit
3c1a71027d
1 changed files with 21 additions and 4 deletions
|
@ -107,7 +107,11 @@ class Helper extends Object {
|
||||||
* @return string Full translated URL with base path.
|
* @return string Full translated URL with base path.
|
||||||
*/
|
*/
|
||||||
function url($url = null, $full = false) {
|
function url($url = null, $full = false) {
|
||||||
$base = strip_plugin($this->base, $this->plugin);
|
if (isset($this->plugin)) {
|
||||||
|
$base = strip_plugin($this->base, $this->plugin);
|
||||||
|
} else {
|
||||||
|
$base = $this->base;
|
||||||
|
}
|
||||||
$extension = null;
|
$extension = null;
|
||||||
|
|
||||||
if (is_array($url) && !empty($url)) {
|
if (is_array($url) && !empty($url)) {
|
||||||
|
@ -271,7 +275,20 @@ class Helper extends Object {
|
||||||
* @param string $tagValue A field name, like "Modelname/fieldname"
|
* @param string $tagValue A field name, like "Modelname/fieldname"
|
||||||
*/
|
*/
|
||||||
function setFormTag($tagValue) {
|
function setFormTag($tagValue) {
|
||||||
return list($this->view->model, $this->view->field) = explode("/", $tagValue);
|
$parts = explode("/", $tagValue);
|
||||||
|
if (count($parts) == 1) {
|
||||||
|
$this->view->field = $parts[0];
|
||||||
|
} elseif (count($parts) == 2 && is_numeric($parts[0])) {
|
||||||
|
$this->view->modelId = $parts[0];
|
||||||
|
$this->view->field = $parts[1];
|
||||||
|
} elseif (count($parts) == 2) {
|
||||||
|
$this->view->model = $parts[0];
|
||||||
|
$this->view->field = $parts[1];
|
||||||
|
} elseif (count($parts) == 3) {
|
||||||
|
$this->view->model = $parts[0];
|
||||||
|
$this->view->modelId = $parts[1];
|
||||||
|
$this->view->field = $parts[2];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Enter description here...
|
* Enter description here...
|
||||||
|
@ -313,7 +330,7 @@ class Helper extends Object {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function domId($options = array(), $id = 'id') {
|
function domId($options = array(), $id = 'id') {
|
||||||
if (!isset($options[$id])) {
|
if (is_array($options) && !isset($options[$id])) {
|
||||||
$options[$id] = $this->model() . Inflector::camelize($this->field());
|
$options[$id] = $this->model() . Inflector::camelize($this->field());
|
||||||
}
|
}
|
||||||
return $options;
|
return $options;
|
||||||
|
@ -346,7 +363,7 @@ class Helper extends Object {
|
||||||
$result = h($this->data[$this->model()][$this->field()]);
|
$result = h($this->data[$this->model()][$this->field()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($options !== 0) {
|
if ($options !== 0 && is_array($options)) {
|
||||||
$options[$key] = $result;
|
$options[$key] = $result;
|
||||||
return $options;
|
return $options;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue