Skip to content

Commit

Permalink
Optimization in postLink and create methods from FormHelper.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Dec 24, 2010
1 parent 3fc8a1f commit ff18fe4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cake/libs/view/helpers/form.php
Expand Up @@ -210,11 +210,13 @@ function create($model = null, $options = array()) {
}
}

$object = $this->_introspectModel($model);
$this->setEntity($model . '.', true);
if ($model !== false) {
$object = $this->_introspectModel($model);
$this->setEntity($model . '.', true);
}

$modelEntity = $this->model();
if (isset($this->fieldset[$modelEntity]['key'])) {
if ($model !== false && isset($this->fieldset[$modelEntity]['key'])) {
$data = $this->fieldset[$modelEntity];
$recordExists = (
isset($this->request->data[$model]) &&
Expand Down Expand Up @@ -1322,6 +1324,7 @@ public function postLink($title, $url = null, $options = array(), $confirmMessag
unset($options['confirm']);
}

$url = $this->url($url);
$formName = uniqid('post_');
$out = $this->create(false, array('url' => $url, 'name' => $formName, 'id' => $formName, 'style' => 'display:none;'));
if (isset($options['data']) && is_array($options['data'])) {
Expand Down

0 comments on commit ff18fe4

Please sign in to comment.