Skip to content

Commit

Permalink
[BUGFIX] Restore label generation for Form-level element
Browse files Browse the repository at this point in the history
  • Loading branch information
NamelessCoder committed Apr 15, 2016
1 parent 27d5d81 commit 41cb134
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions Classes/Form/AbstractFormComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,18 +280,13 @@ protected function resolveLocalLanguageValueOfLabel($label, $path = NULL) {
} elseif (!empty($label)) {
return $label;
}
$root = $this->getRoot();
if (FALSE === $root instanceof Form) {
$id = 'form';
} else {
$id = $root->getName();
if ($this instanceof Form) {
return $filePrefix . ':flux.form.' . $this->getName();
}
$root = $this->getRoot();
$id = $root->getName();
if (empty($path)) {
if (!$this instanceof Form) {
$path = $this->getPath();
} else {
$path = '';
}
$path = $this->getPath();
}
return $filePrefix . ':' . trim('flux.' . $id . '.' . $path, '.');
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Backend/TableConfigurationPostProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function canCreateTcaFromFluxForm() {
$this->assertContains($field, $GLOBALS['TCA'][$table]['interface']['showRecordFieldList']);
$this->assertContains($field, $GLOBALS['TCA'][$table]['types'][0]['showitem']);
$this->assertEquals($GLOBALS['TCA'][$table]['ctrl']['label'], 'title');
$this->assertContains('flux.this_table_does_not_exist', $GLOBALS['TCA'][$table]['ctrl']['title']);
$this->assertContains('flux.form.this_table_does_not_exist', $GLOBALS['TCA'][$table]['ctrl']['title']);
}

/**
Expand Down

4 comments on commit 41cb134

@tpinne
Copy link
Contributor

@tpinne tpinne commented on 41cb134 Apr 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @NamelessCoder ,

I'm not really aware of the reason behind this change or what restoring means in this context, but I think this will break a lot of labels for forms. Because in the current documentation of the label attribute for <flux:form ../> states that an identifier in the form flux.formId will be looked up if none is given explicitly.

With this change a guessed label will have to be in the form flux.**form.**formId. I noticed that in my current project after I updated to the latest version of the development branch where all my form labels were gone because I sticked to the current documentation. Which I also did in every other project in the past. And I guess I'm not the only one ;-)
So if there will be made an update to the next release version all forms (and page layouts of course) will sit there with no name having only a description.

Am I totally wrong here or missing something?

@monosize
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tpinne, @NamelessCoder

This is a breaking change!
All labels in the existing language files must be updated.

As @tpinne has described, This change will cause many problems ...

@NamelessCoder
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're both right guys - would you mind preparing a PR to follow up on this? I'm a little short on time these days.

@monosize
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tpinne, @NamelessCoder

I have prepared a PR. #1123

Please sign in to comment.