mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #2290 from open-sausages/pulls/4/lazy-load-gridfield
MINOR Enable the lazy loading for DependentPages GridField
This commit is contained in:
commit
d1c3a96653
@ -32,6 +32,8 @@ use SilverStripe\Forms\FieldList;
|
|||||||
use SilverStripe\Forms\FormAction;
|
use SilverStripe\Forms\FormAction;
|
||||||
use SilverStripe\Forms\GridField\GridField;
|
use SilverStripe\Forms\GridField\GridField;
|
||||||
use SilverStripe\Forms\GridField\GridFieldDataColumns;
|
use SilverStripe\Forms\GridField\GridFieldDataColumns;
|
||||||
|
use SilverStripe\Forms\GridField\GridFieldLazyLoader;
|
||||||
|
use SilverStripe\Forms\GridField\GridFieldSortableHeader;
|
||||||
use SilverStripe\Forms\HTMLEditor\HTMLEditorField;
|
use SilverStripe\Forms\HTMLEditor\HTMLEditorField;
|
||||||
use SilverStripe\Forms\LiteralField;
|
use SilverStripe\Forms\LiteralField;
|
||||||
use SilverStripe\Forms\OptionsetField;
|
use SilverStripe\Forms\OptionsetField;
|
||||||
@ -1881,7 +1883,6 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
|||||||
if ($dependentPagesCount) {
|
if ($dependentPagesCount) {
|
||||||
$dependentColumns = array(
|
$dependentColumns = array(
|
||||||
'Title' => $this->fieldLabel('Title'),
|
'Title' => $this->fieldLabel('Title'),
|
||||||
'AbsoluteLink' => _t(__CLASS__.'.DependtPageColumnURL', 'URL'),
|
|
||||||
'DependentLinkType' => _t(__CLASS__.'.DependtPageColumnLinkType', 'Link type'),
|
'DependentLinkType' => _t(__CLASS__.'.DependtPageColumnLinkType', 'Link type'),
|
||||||
);
|
);
|
||||||
if (class_exists('Subsite')) {
|
if (class_exists('Subsite')) {
|
||||||
@ -1895,7 +1896,7 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
|||||||
$dependentPages
|
$dependentPages
|
||||||
);
|
);
|
||||||
/** @var GridFieldDataColumns $dataColumns */
|
/** @var GridFieldDataColumns $dataColumns */
|
||||||
$dataColumns = $dependentTable->getConfig()->getComponentByType('SilverStripe\\Forms\\GridField\\GridFieldDataColumns');
|
$dataColumns = $dependentTable->getConfig()->getComponentByType(GridFieldDataColumns::class);
|
||||||
$dataColumns
|
$dataColumns
|
||||||
->setDisplayFields($dependentColumns)
|
->setDisplayFields($dependentColumns)
|
||||||
->setFieldFormatting(array(
|
->setFieldFormatting(array(
|
||||||
@ -1905,15 +1906,9 @@ class SiteTree extends DataObject implements PermissionProvider, i18nEntityProvi
|
|||||||
(int)$item->ID,
|
(int)$item->ID,
|
||||||
Convert::raw2xml($item->Title)
|
Convert::raw2xml($item->Title)
|
||||||
);
|
);
|
||||||
},
|
|
||||||
'AbsoluteLink' => function ($value, &$item) {
|
|
||||||
return sprintf(
|
|
||||||
'<a href="%s" target="_blank">%s</a>',
|
|
||||||
Convert::raw2xml($value),
|
|
||||||
Convert::raw2xml($value)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
$dependentTable->getConfig()->addComponent(new GridFieldLazyLoader());
|
||||||
}
|
}
|
||||||
|
|
||||||
$baseLink = Controller::join_links(
|
$baseLink = Controller::join_links(
|
||||||
|
Loading…
Reference in New Issue
Block a user