mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
ENHANCEMENT Using DataObject->Title for has_one dropdowns generated in DataObject->scaffoldFormFields()
MINOR Removed scaffolded header field in DataObject->scaffoldFormFields() git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63632 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
df199ebc2b
commit
7da3497668
@ -1498,7 +1498,6 @@ class DataObject extends ViewableData implements DataObjectInterface {
|
|||||||
*/
|
*/
|
||||||
public function scaffoldFormFields($fieldClasses = null) {
|
public function scaffoldFormFields($fieldClasses = null) {
|
||||||
$fields = new FieldSet();
|
$fields = new FieldSet();
|
||||||
$fields->push(new HeaderField($this->singular_name()));
|
|
||||||
foreach($this->db() as $fieldName => $fieldType) {
|
foreach($this->db() as $fieldName => $fieldType) {
|
||||||
// @todo Pass localized title
|
// @todo Pass localized title
|
||||||
if(isset($fieldClasses[$fieldName])) {
|
if(isset($fieldClasses[$fieldName])) {
|
||||||
@ -1513,9 +1512,9 @@ class DataObject extends ViewableData implements DataObjectInterface {
|
|||||||
foreach($this->has_one() as $relationship => $component) {
|
foreach($this->has_one() as $relationship => $component) {
|
||||||
$model = singleton($component);
|
$model = singleton($component);
|
||||||
$records = DataObject::get($component);
|
$records = DataObject::get($component);
|
||||||
$collect = ($model->hasMethod('customSelectOption')) ? 'customSelectOption' : current($model->summaryFields());
|
$collect = ($model->hasMethod('customSelectOption')) ? 'customSelectOption' : 'Title';
|
||||||
$options = $records ? $records->filter_map('ID', $collect) : array();
|
$options = $records ? $records->filter_map('ID', $collect) : array();
|
||||||
$fields->push(new DropdownField($relationship.'ID', $relationship, $options));
|
$fields->push(new DropdownField($relationship.'ID', $this->fieldLabel($relationship), $options));
|
||||||
}
|
}
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user