mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #2720 from signify-nz/enh/gridfieldcomponents-di
ENH Prefer dependency injection for GridFieldComponents
This commit is contained in:
commit
07df04f3c4
@ -1632,9 +1632,9 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
}
|
}
|
||||||
$list = $this->getList($params, $parentID);
|
$list = $this->getList($params, $parentID);
|
||||||
$gridFieldConfig = GridFieldConfig::create()->addComponents(
|
$gridFieldConfig = GridFieldConfig::create()->addComponents(
|
||||||
new GridFieldSortableHeader(),
|
Injector::inst()->create(GridFieldSortableHeader::class),
|
||||||
new GridFieldDataColumns(),
|
Injector::inst()->create(GridFieldDataColumns::class),
|
||||||
new GridFieldPaginator($this->config()->get('page_length'))
|
Injector::inst()->createWithArgs(GridFieldPaginator::class, [$this->config()->get('page_length')])
|
||||||
);
|
);
|
||||||
if ($parentID) {
|
if ($parentID) {
|
||||||
$linkSpec = $this->LinkListViewChildren('%d');
|
$linkSpec = $this->LinkListViewChildren('%d');
|
||||||
@ -1645,7 +1645,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
);
|
);
|
||||||
$this->setCurrentPageID($parentID);
|
$this->setCurrentPageID($parentID);
|
||||||
}
|
}
|
||||||
$gridField = new GridField('Page', 'Pages', $list, $gridFieldConfig);
|
$gridField = GridField::create('Page', 'Pages', $list, $gridFieldConfig);
|
||||||
$gridField->setAttribute('cms-loading-ignore-url-params', true);
|
$gridField->setAttribute('cms-loading-ignore-url-params', true);
|
||||||
/** @var GridFieldDataColumns $columns */
|
/** @var GridFieldDataColumns $columns */
|
||||||
$columns = $gridField->getConfig()->getComponentByType(GridFieldDataColumns::class);
|
$columns = $gridField->getConfig()->getComponentByType(GridFieldDataColumns::class);
|
||||||
|
@ -1996,7 +1996,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
$dependentTable->getConfig()->addComponent(new GridFieldLazyLoader());
|
$dependentTable->getConfig()->addComponent(Injector::inst()->create(GridFieldLazyLoader::class));
|
||||||
}
|
}
|
||||||
|
|
||||||
$baseLink = Controller::join_links(
|
$baseLink = Controller::join_links(
|
||||||
|
Loading…
Reference in New Issue
Block a user