mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Un-hard code ViewState argument
This commit is contained in:
parent
db5f81d393
commit
b0380d8766
@ -838,7 +838,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
$dateGroup->setTitle(_t('SilverStripe\\CMS\\Search\\SearchForm.PAGEFILTERDATEHEADING', 'Last edited'));
|
$dateGroup->setTitle(_t('SilverStripe\\CMS\\Search\\SearchForm.PAGEFILTERDATEHEADING', 'Last edited'));
|
||||||
|
|
||||||
// view mode
|
// view mode
|
||||||
$viewMode = HiddenField::create('view', false, 'listview');
|
$viewMode = HiddenField::create('view', false, $this->ViewState('listview'));
|
||||||
|
|
||||||
// Create the Field list
|
// Create the Field list
|
||||||
$fields = new FieldList(
|
$fields = new FieldList(
|
||||||
@ -1307,9 +1307,10 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $default
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function ViewState()
|
public function ViewState($default = 'treeview')
|
||||||
{
|
{
|
||||||
$mode = $this->getRequest()->requestVar('view')
|
$mode = $this->getRequest()->requestVar('view')
|
||||||
?: $this->getRequest()->param('Action');
|
?: $this->getRequest()->param('Action');
|
||||||
@ -1318,7 +1319,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
case 'treeview':
|
case 'treeview':
|
||||||
return $mode;
|
return $mode;
|
||||||
default:
|
default:
|
||||||
return 'treeview';
|
return $default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user