Skip to content
Browse files

BUGFIX Fixing ListViewForm using setDisplayFields on GridField, not t…

…he component
  • Loading branch information...
1 parent 7c54c60 commit a610a8c5e97599447f94d616f23af5eeb15e6d71 @halkyon committed May 1, 2012
Showing with 12 additions and 16 deletions.
  1. +12 −16 code/controllers/CMSMain.php
View
28 code/controllers/CMSMain.php
@@ -666,7 +666,7 @@ public function getList($params, $parentID = 0) {
return $list;
}
- public function ListViewForm(){
+ public function ListViewForm() {
$params = $this->request->requestVar('q');
$list = $this->getList($params, $this->request->requestVar('ParentID'));
$gridFieldConfig = GridFieldConfig::create()->addComponents(
@@ -678,21 +678,17 @@ public function ListViewForm(){
$columns = $gridField->getConfig()->getComponentByType('GridFieldDataColumns');
// Don't allow navigating into children nodes on filtered lists
- if($params){
- $gridField->setDisplayFields(array(
- 'getTreeTitle' => _t('SiteTree.PAGETITLE', 'Page Title'),
- 'Created' => _t('SiteTree.CREATED', 'Date Created'),
- 'LastEdited' => _t('SiteTree.LASTUPDATED', 'Last Updated'),
- ));
- }else{
- $columns->setDisplayFields(array(
- 'listChildrenLink' => "",
- 'getTreeTitle' => _t('SiteTree.PAGETITLE', 'Page Title'),
- 'Created' => _t('SiteTree.CREATED', 'Date Created'),
- 'LastEdited' => _t('SiteTree.LASTUPDATED', 'Last Updated'),
- ));
+ $fields = array(
+ 'getTreeTitle' => _t('SiteTree.PAGETITLE', 'Page Title'),
+ 'Created' => _t('SiteTree.CREATED', 'Date Created'),
+ 'LastEdited' => _t('SiteTree.LASTUPDATED', 'Last Updated'),
+ );
+
+ if($params) {
+ $fields = array_merge(array('listChildrenLink' => ''), $fields);
}
-
+
+ $columns->setDisplayFields($fields);
$columns->setFieldCasting(array(
'Created' => 'Date->Ago',
'LastEdited' => 'Date->Ago',
@@ -708,7 +704,7 @@ public function ListViewForm(){
$controller->Link(),
$item->ID,
$num
- );
+ );
}
},
'getTreeTitle' => '<a class=\"cms-panel-link\" href=\"' .

0 comments on commit a610a8c

Please sign in to comment.
Something went wrong with that request. Please try again.