ENHANCEMENT Disrecard $includeRelations setting when scaffolding $has_one relationships in FormScaffolder - use $restrictFields to limit instead

BUGFIX Using fieldLabel() for $has_one relationships in FormScaffolder

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64224 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-10-14 19:31:18 +00:00
parent 90f3b87f35
commit 524d7a9011

View File

@ -89,10 +89,11 @@ class FormScaffolder extends Object {
} }
// add has_one relation fields // add has_one relation fields
if($this->obj->has_one() && ($this->includeRelations === true || isset($this->includeRelations['has_one']))) { if($this->obj->has_one()) {
foreach($this->obj->has_one() as $relationship => $component) { foreach($this->obj->has_one() as $relationship => $component) {
if($this->restrictFields && !in_array($relationship, $this->restrictFields)) continue; if($this->restrictFields && !in_array($relationship, $this->restrictFields)) continue;
$hasOneField = $this->obj->dbObject("{$relationship}ID")->scaffoldFormField(null, $this->getParamsArray()); $hasOneField = $this->obj->dbObject("{$relationship}ID")->scaffoldFormField(null, $this->getParamsArray());
$hasOneField->setTitle($this->obj->fieldLabel($relationship));
if($this->tabbed) { if($this->tabbed) {
$fields->addFieldToTab("Root.Main", $hasOneField); $fields->addFieldToTab("Root.Main", $hasOneField);
} else { } else {