mirror of
https://github.com/getformwork/formwork.git
synced 2025-01-17 13:38:22 +01:00
Move sortable page logic in Page
class
This commit is contained in:
parent
03ba1a77aa
commit
5baf18fe8e
@ -1,11 +1,10 @@
|
||||
<ul class="pages-list <?= $class ?>" data-sortable="<?= $sortable ?>" <?php if ($parent): ?>data-parent="<?= $parent ?>"<?php endif; ?>>
|
||||
<?php
|
||||
foreach ($pages as $page):
|
||||
$reorder = is_null($page->num()) || $page->template()->scheme()->get('num') == 'date';
|
||||
$routable = $page->published() && $page->routable();
|
||||
$date = date($this->option('date.format') . ' ' . $this->option('date.hour_format'), $page->lastModifiedTime());
|
||||
?>
|
||||
<li class="<?php if ($subpages): ?>pages-level-<?= $page->level() ?><?php endif; ?><?php if ($reorder): ?> not-sortable<?php endif; ?>">
|
||||
<li class="<?php if ($subpages): ?>pages-level-<?= $page->level() ?><?php endif; ?><?php if (!$page->sortable()): ?> not-sortable<?php endif; ?>">
|
||||
<div class="pages-item">
|
||||
<div class="pages-item-cell page-details">
|
||||
<div class="page-title">
|
||||
|
@ -34,7 +34,8 @@ class Page extends AbstractPage {
|
||||
'published' => true,
|
||||
'routable' => true,
|
||||
'searchable' => true,
|
||||
'cacheable' => true
|
||||
'cacheable' => true,
|
||||
'sortable' => true
|
||||
);
|
||||
}
|
||||
|
||||
@ -98,6 +99,10 @@ class Page extends AbstractPage {
|
||||
// If the page isn't published, it won't also be visible
|
||||
if (!$this->published()) $this->data['visible'] = false;
|
||||
|
||||
if (is_null($this->num()) || $this->template()->scheme()->get('num') == 'date') {
|
||||
$this->data['sortable'] = false;
|
||||
}
|
||||
|
||||
// Prepends the page uri if image uri doesn't start with '/', which means it isn't relative to the root
|
||||
if ($this->has('image') && $this->image()[0] != '/') {
|
||||
$this->data['image'] = $this->uri($this->image());
|
||||
|
Loading…
x
Reference in New Issue
Block a user