mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
BUGFIX Fixing ListViewForm using setDisplayFields on GridField, not the component
This commit is contained in:
parent
7c54c60311
commit
a610a8c5e9
@ -666,7 +666,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ListViewForm(){
|
public function ListViewForm() {
|
||||||
$params = $this->request->requestVar('q');
|
$params = $this->request->requestVar('q');
|
||||||
$list = $this->getList($params, $this->request->requestVar('ParentID'));
|
$list = $this->getList($params, $this->request->requestVar('ParentID'));
|
||||||
$gridFieldConfig = GridFieldConfig::create()->addComponents(
|
$gridFieldConfig = GridFieldConfig::create()->addComponents(
|
||||||
@ -678,21 +678,17 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
$columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
|
$columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
|
||||||
|
|
||||||
// Don't allow navigating into children nodes on filtered lists
|
// Don't allow navigating into children nodes on filtered lists
|
||||||
if($params){
|
$fields = array(
|
||||||
$gridField->setDisplayFields(array(
|
'getTreeTitle' => _t('SiteTree.PAGETITLE', 'Page Title'),
|
||||||
'getTreeTitle' => _t('SiteTree.PAGETITLE', 'Page Title'),
|
'Created' => _t('SiteTree.CREATED', 'Date Created'),
|
||||||
'Created' => _t('SiteTree.CREATED', 'Date Created'),
|
'LastEdited' => _t('SiteTree.LASTUPDATED', 'Last Updated'),
|
||||||
'LastEdited' => _t('SiteTree.LASTUPDATED', 'Last Updated'),
|
);
|
||||||
));
|
|
||||||
}else{
|
if($params) {
|
||||||
$columns->setDisplayFields(array(
|
$fields = array_merge(array('listChildrenLink' => ''), $fields);
|
||||||
'listChildrenLink' => "",
|
|
||||||
'getTreeTitle' => _t('SiteTree.PAGETITLE', 'Page Title'),
|
|
||||||
'Created' => _t('SiteTree.CREATED', 'Date Created'),
|
|
||||||
'LastEdited' => _t('SiteTree.LASTUPDATED', 'Last Updated'),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$columns->setDisplayFields($fields);
|
||||||
$columns->setFieldCasting(array(
|
$columns->setFieldCasting(array(
|
||||||
'Created' => 'Date->Ago',
|
'Created' => 'Date->Ago',
|
||||||
'LastEdited' => 'Date->Ago',
|
'LastEdited' => 'Date->Ago',
|
||||||
@ -708,7 +704,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
$controller->Link(),
|
$controller->Link(),
|
||||||
$item->ID,
|
$item->ID,
|
||||||
$num
|
$num
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'getTreeTitle' => '<a class=\"cms-panel-link\" href=\"' .
|
'getTreeTitle' => '<a class=\"cms-panel-link\" href=\"' .
|
||||||
|
Loading…
Reference in New Issue
Block a user