Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Take advantage of auto-scaffolded form fields #581

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions src/Model/Subsite.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
use SilverStripe\Versioned\Versioned;
use UnexpectedValueException;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Forms\GridField\GridFieldAddExistingAutocompleter;

/**
* A dynamically created subsite. SiteTree objects can now belong to a subsite.
Expand Down Expand Up @@ -666,16 +667,10 @@ public function canEdit($member = false)
public function getCMSFields()
{
$this->beforeUpdateCMSFields(function (FieldList $fields) {
if ($this->exists()) {
// Add a GridField for domains to a new tab if the subsite has already been created
$fields->addFieldsToTab('Root.Domains', [
GridField::create(
'Domains',
'',
$this->Domains(),
GridFieldConfig_RecordEditor::create(10)
)
]);
$domainsGridField = $fields->dataFieldByName('Domains');
if ($domainsGridField instanceof GridField) {
$domainsGridField->setTitle('');
$domainsGridField->getConfig()->removeComponentsByType(GridFieldAddExistingAutocompleter::class);
GuySartorelli marked this conversation as resolved.
Show resolved Hide resolved
}
GuySartorelli marked this conversation as resolved.
Show resolved Hide resolved

// Remove the default scaffolded blacklist field, we replace it with a checkbox set field
Expand Down
Loading