mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 06:05:56 +00:00
ENH Auto-scaffold SiteTree relations with tree fields (#2970)
This commit is contained in:
parent
0eccb06623
commit
4e974fe1e8
@ -31,6 +31,7 @@ use SilverStripe\Forms\DropdownField;
|
||||
use SilverStripe\Forms\FieldGroup;
|
||||
use SilverStripe\Forms\FieldList;
|
||||
use SilverStripe\Forms\FormAction;
|
||||
use SilverStripe\Forms\FormField;
|
||||
use SilverStripe\Forms\GridField\GridField;
|
||||
use SilverStripe\Forms\GridField\GridFieldDataColumns;
|
||||
use SilverStripe\Forms\GridField\GridFieldLazyLoader;
|
||||
@ -1536,6 +1537,34 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
||||
$this->versionProvider = $versionProvider;
|
||||
}
|
||||
|
||||
public function scaffoldFormFieldForHasOne(
|
||||
string $fieldName,
|
||||
?string $fieldTitle,
|
||||
string $relationName,
|
||||
DataObject $ownerRecord
|
||||
): FormField {
|
||||
return TreeDropdownField::create($fieldName, $fieldTitle, static::class);
|
||||
}
|
||||
|
||||
public function scaffoldFormFieldForHasMany(
|
||||
string $relationName,
|
||||
?string $fieldTitle,
|
||||
DataObject $ownerRecord,
|
||||
bool &$includeInOwnTab
|
||||
): FormField {
|
||||
$includeInOwnTab = false;
|
||||
return TreeMultiselectField::create($relationName, $fieldTitle, static::class);
|
||||
}
|
||||
|
||||
public function scaffoldFormFieldForManyMany(
|
||||
string $relationName,
|
||||
?string $fieldTitle,
|
||||
DataObject $ownerRecord,
|
||||
bool &$includeInOwnTab
|
||||
): FormField {
|
||||
$includeInOwnTab = false;
|
||||
return TreeMultiselectField::create($relationName, $fieldTitle, static::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the title, description, keywords and language metatags.
|
||||
|
Loading…
x
Reference in New Issue
Block a user