Skip to content

Commit

Permalink
Get the legend element working again.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Mar 4, 2014
1 parent a5ed2c2 commit b959378
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions src/View/Helper/FormHelper.php
Expand Up @@ -769,15 +769,11 @@ public function inputs($fields = null, $blacklist = null, $options = array()) {
if ($legend === true) {
$actionName = __d('cake', 'New %s');
$isCreate = $context->isCreate();
$isEdit = (
strpos($this->request->params['action'], 'update') !== false ||
strpos($this->request->params['action'], 'edit') !== false
);
if ($isEdit) {
if (!$isCreate) {
$actionName = __d('cake', 'Edit %s');
}
$modelName = Inflector::humanize(Inflector::underscore($model));
$legend = sprintf($actionName, __($modelName));
$modelName = Inflector::humanize(Inflector::singularize($this->request->params['controller']));
$legend = sprintf($actionName, $modelName);
}

$out = null;
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/View/Helper/FormHelperTest.php
Expand Up @@ -2534,7 +2534,7 @@ public function testFormInputsLegendFieldset() {
$expected = [
'<fieldset',
'<legend',
'Edit Article',
'New Article',
'/legend',
'*/fieldset',
];
Expand Down

0 comments on commit b959378

Please sign in to comment.