Browse files

Get the legend element working again.

  • Loading branch information...
1 parent a5ed2c2 commit b959378233404db714813a5e397e27484cba558a @markstory markstory committed Mar 3, 2014
Showing with 4 additions and 8 deletions.
  1. +3 −7 src/View/Helper/FormHelper.php
  2. +1 −1 tests/TestCase/View/Helper/FormHelperTest.php
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',
];

0 comments on commit b959378

Please sign in to comment.