mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 19:38:26 +00:00
adding automatic hidden field for FormHelper::input(), removed create() from bake controller edit
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4097 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
64997718e0
commit
f5e2dea563
2 changed files with 6 additions and 5 deletions
|
@ -99,7 +99,7 @@ class FormHelper extends AppHelper {
|
||||||
if (empty($options['action']) || is_array($options['action'])) {
|
if (empty($options['action']) || is_array($options['action'])) {
|
||||||
$options = (array)$options;
|
$options = (array)$options;
|
||||||
$actionDefaults = array(
|
$actionDefaults = array(
|
||||||
'controller' => Inflector::underscore($this->params['controller']),
|
'controller' => $this->params['controller'],
|
||||||
'action' => $created ? 'edit' : 'add',
|
'action' => $created ? 'edit' : 'add',
|
||||||
'id' => $created ? $this->data[$model][$data['key']] : null
|
'id' => $created ? $this->data[$model][$data['key']] : null
|
||||||
);
|
);
|
||||||
|
@ -233,9 +233,8 @@ class FormHelper extends AppHelper {
|
||||||
} elseif (ClassRegistry::isKeySet($this->model())) {
|
} elseif (ClassRegistry::isKeySet($this->model())) {
|
||||||
$model =& ClassRegistry::getObject($this->model());
|
$model =& ClassRegistry::getObject($this->model());
|
||||||
$type = $model->getColumnType($this->field());
|
$type = $model->getColumnType($this->field());
|
||||||
|
|
||||||
$map = array(
|
$map = array(
|
||||||
'string' => 'text', 'datetime' => 'datetime',
|
'string' => 'text', 'datetime' => 'datetime',
|
||||||
'boolean' => 'checkbox', 'timestamp' => 'datetime',
|
'boolean' => 'checkbox', 'timestamp' => 'datetime',
|
||||||
'text' => 'textarea', 'time' => 'time',
|
'text' => 'textarea', 'time' => 'time',
|
||||||
'date' => 'date'
|
'date' => 'date'
|
||||||
|
@ -243,6 +242,9 @@ class FormHelper extends AppHelper {
|
||||||
if (isset($map[$type])) {
|
if (isset($map[$type])) {
|
||||||
$options['type'] = $map[$type];
|
$options['type'] = $map[$type];
|
||||||
}
|
}
|
||||||
|
if($this->field() == $model->primaryKey) {
|
||||||
|
$options['type'] = 'hidden';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -729,7 +731,7 @@ class FormHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
* @see FormHelper::fields()
|
* @see FormHelper::displayFields()
|
||||||
*/
|
*/
|
||||||
function generateFields($fields, $readOnly = false) {
|
function generateFields($fields, $readOnly = false) {
|
||||||
trigger_error('Deprecated: Use FormHelper::input() instead', E_USER_WARNING);
|
trigger_error('Deprecated: Use FormHelper::input() instead', E_USER_WARNING);
|
||||||
|
|
|
@ -1446,7 +1446,6 @@ class Bake {
|
||||||
$actions .= "\t\t}\n";
|
$actions .= "\t\t}\n";
|
||||||
$actions .= "\t\tif(!empty(\$this->data)) {\n";
|
$actions .= "\t\tif(!empty(\$this->data)) {\n";
|
||||||
$actions .= "\t\t\t\$this->cleanUpFields();\n";
|
$actions .= "\t\t\t\$this->cleanUpFields();\n";
|
||||||
$actions .= "\t\t\t\$this->{$currentModelName}->create();\n";
|
|
||||||
$actions .= "\t\t\tif(\$this->{$currentModelName}->save(\$this->data)) {\n";
|
$actions .= "\t\t\tif(\$this->{$currentModelName}->save(\$this->data)) {\n";
|
||||||
if (low($wannaUseSession) == 'y' || low($wannaUseSession) == 'yes') {
|
if (low($wannaUseSession) == 'y' || low($wannaUseSession) == 'yes') {
|
||||||
$actions .= "\t\t\t\t\$this->Session->setFlash('The ".$this->__singularHumanName($currentModelName)." has been saved');\n";
|
$actions .= "\t\t\t\t\$this->Session->setFlash('The ".$this->__singularHumanName($currentModelName)." has been saved');\n";
|
||||||
|
|
Loading…
Reference in a new issue