You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.0 KiB
57 lines
1.0 KiB
<?php
|
|
|
|
return [
|
|
'props' => [
|
|
/**
|
|
* Enables/disables reverse sorting
|
|
*/
|
|
'flip' => function (bool $flip = false) {
|
|
return $flip;
|
|
},
|
|
/**
|
|
* Enables/disables manual sorting
|
|
*/
|
|
'sortable' => function (bool $sortable = true) {
|
|
return $sortable;
|
|
},
|
|
/**
|
|
* Overwrites manual sorting and sorts by the given field and sorting direction (i.e. `date desc`)
|
|
*/
|
|
'sortBy' => function (string $sortBy = null) {
|
|
return $sortBy;
|
|
},
|
|
],
|
|
'computed' => [
|
|
'sortable' => function () {
|
|
if ($this->sortable === false) {
|
|
return false;
|
|
}
|
|
|
|
if (
|
|
$this->type === 'pages' &&
|
|
in_array($this->status, ['listed', 'published', 'all']) === false
|
|
) {
|
|
return false;
|
|
}
|
|
|
|
// don't allow sorting while search filter is active
|
|
if (empty($this->searchterm()) === false) {
|
|
return false;
|
|
}
|
|
|
|
if ($this->query !== null) {
|
|
return false;
|
|
}
|
|
|
|
if ($this->sortBy !== null) {
|
|
return false;
|
|
}
|
|
|
|
if ($this->flip === true) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
]
|
|
];
|
|
|