mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
90f3b87f35
commit
524d7a9011
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user