mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +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'])) {
|
||||
$options = (array)$options;
|
||||
$actionDefaults = array(
|
||||
'controller' => Inflector::underscore($this->params['controller']),
|
||||
'controller' => $this->params['controller'],
|
||||
'action' => $created ? 'edit' : 'add',
|
||||
'id' => $created ? $this->data[$model][$data['key']] : null
|
||||
);
|
||||
|
@ -233,7 +233,6 @@ class FormHelper extends AppHelper {
|
|||
} elseif (ClassRegistry::isKeySet($this->model())) {
|
||||
$model =& ClassRegistry::getObject($this->model());
|
||||
$type = $model->getColumnType($this->field());
|
||||
|
||||
$map = array(
|
||||
'string' => 'text', 'datetime' => 'datetime',
|
||||
'boolean' => 'checkbox', 'timestamp' => 'datetime',
|
||||
|
@ -243,6 +242,9 @@ class FormHelper extends AppHelper {
|
|||
if (isset($map[$type])) {
|
||||
$options['type'] = $map[$type];
|
||||
}
|
||||
if($this->field() == $model->primaryKey) {
|
||||
$options['type'] = 'hidden';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -729,7 +731,7 @@ class FormHelper extends AppHelper {
|
|||
}
|
||||
/**
|
||||
* @deprecated
|
||||
* @see FormHelper::fields()
|
||||
* @see FormHelper::displayFields()
|
||||
*/
|
||||
function generateFields($fields, $readOnly = false) {
|
||||
trigger_error('Deprecated: Use FormHelper::input() instead', E_USER_WARNING);
|
||||
|
|
|
@ -1446,7 +1446,6 @@ class Bake {
|
|||
$actions .= "\t\t}\n";
|
||||
$actions .= "\t\tif(!empty(\$this->data)) {\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";
|
||||
if (low($wannaUseSession) == 'y' || low($wannaUseSession) == 'yes') {
|
||||
$actions .= "\t\t\t\t\$this->Session->setFlash('The ".$this->__singularHumanName($currentModelName)." has been saved');\n";
|
||||
|
|
Loading…
Reference in a new issue