Update Kirby and dependencies
This commit is contained in:
parent
07150a0011
commit
c7c5d615a4
451 changed files with 67540 additions and 63740 deletions
53
kirby/config/sections/mixins/sort.php
Normal file
53
kirby/config/sections/mixins/sort.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?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->sortBy !== null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->flip === true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
]
|
||||
];
|
Loading…
Add table
Add a link
Reference in a new issue