Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Get the legend element working again.

  • Loading branch information...
commit b959378233404db714813a5e397e27484cba558a 1 parent a5ed2c2
@markstory markstory authored
View
10 src/View/Helper/FormHelper.php
@@ -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;
View
2  tests/TestCase/View/Helper/FormHelperTest.php
@@ -2534,7 +2534,7 @@ public function testFormInputsLegendFieldset() {
$expected = [
'<fieldset',
'<legend',
- 'Edit Article',
+ 'New Article',
'/legend',
'*/fieldset',
];
Please sign in to comment.
Something went wrong with that request. Please try again.