Skip to content

Commit 3bc4518

Browse files
committed
Merge branch 'develop'
2 parents 8b6fbdb + 8e32a15 commit 3bc4518

File tree

4 files changed

+60
-26
lines changed

4 files changed

+60
-26
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Features with Blueprint options:
1212

1313
This plugin is compatible with [rasteiner/k3-pagesdisplay-sections](https://github.com/rasteiner/k3-pagesdisplay-section)
1414

15+
From Kirby 3.5 use v5.0\
1516
From Kirby 3.6 use v4.0\
1617
From Kirby 3.5 use v3.0\
1718
From Kirby 3.2.5 use v2.2.x\

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
"description": "Allow single language pages/site/users in a multi language setup, hide buttons in topbar and sections.",
44
"type": "kirby-plugin",
55
"license": "MIT",
6-
"version": "4.1",
6+
"version": "5.0",
77
"authors": [
88
{
99
"name": "Matthias Müller",
1010
"email": "[email protected]"
1111
}
1212
],
1313
"require": {
14-
"getkirby/composer-installer": "^1.1"
14+
"getkirby/composer-installer": "^1.2"
15+
},
16+
"conflict": {
17+
"getkirby/cms": "<3.7"
1518
}
1619
}

index.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,39 @@
4848
}
4949
}
5050

51+
function extendTableComponent (component) {
52+
return {
53+
extends: component,
54+
watch: {
55+
rows () {
56+
for (const key in this.rows) {
57+
const row = this.rows[key]
58+
59+
if (!row.blueprintOptions) continue
60+
61+
if (row.blueprintOptions.hideOptions === true || row.blueprintOptions.hideSettings === true) {
62+
this.rows[key].options = {}
63+
}
64+
65+
if (row.blueprintOptions.hideOptions === true || row.blueprintOptions.hideStatus === true) {
66+
if ('flag' in this.rows[key]) delete this.rows[key].flag
67+
}
68+
}
69+
70+
this.values = this.rows
71+
}
72+
}
73+
}
74+
}
75+
5176
/**
52-
* Extend item to hide settings & status in sections
77+
* Extend item / table to hide settings & status in sections
5378
* Extend site / page / user view to hide settings / status and language dropdown
5479
*/
5580
panel.plugin('mullema/k3-panel-view-extended', {
5681
components: {
5782
'k-item': extendComponent('k-item'),
83+
'k-table': extendTableComponent('k-table'),
5884
'k-site-view': extendView('k-site-view'),
5985
'k-page-view': extendView('k-page-view'),
6086
'k-user-view': extendView('k-user-view')

src/extension.php

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,45 @@
66
'computed' => [
77
// https://github.com/getkirby/kirby/blob/master/config/sections/pages.php
88
'data' => function () {
9-
109
$data = [];
1110

12-
foreach ($this->pages as $item) {
13-
$blueprint = $item->blueprint(); // panel-view-extended
14-
$permissions = $item->permissions();
15-
$image = $item->panelImage($this->image);
16-
17-
// escape the default text
18-
// TODO: no longer needed in 3.6
19-
$text = $item->toString($this->text);
20-
if ($this->text === '{{ page.title }}') {
21-
$text = Escape::html($text);
22-
}
11+
foreach ($this->pages as $page) {
12+
$blueprint = $page->blueprint(); // panel-view-extended
13+
$panel = $page->panel();
14+
$permissions = $page->permissions();
2315

24-
$data[] = [
25-
'id' => $item->id(),
26-
'dragText' => $item->dragText(),
27-
'text' => $text,
28-
'info' => $item->toString($this->info ?? false),
29-
'parent' => $item->parentId(),
30-
'icon' => $item->panelIcon($image),
31-
'image' => $image,
32-
'link' => $item->panelUrl(true),
33-
'status' => $item->status(),
16+
$item = [
17+
'dragText' => $panel->dragText(),
18+
'id' => $page->id(),
19+
'image' => $panel->image(
20+
$this->image,
21+
$this->layout === 'table' ? 'list' : $this->layout
22+
),
23+
'info' => $page->toSafeString($this->info ?? false),
24+
'link' => $panel->url(true),
25+
'parent' => $page->parentId(),
3426
'permissions' => [
3527
'sort' => $permissions->can('sort'),
3628
'changeSlug' => $permissions->can('changeSlug'),
3729
'changeStatus' => $permissions->can('changeStatus'),
38-
'changeTitle' => $permissions->can('changeTitle')
30+
'changeTitle' => $permissions->can('changeTitle'),
3931
],
32+
'status' => $page->status(),
33+
'template' => $page->intendedTemplate()->name(),
34+
'text' => $page->toSafeString($this->text),
4035
'blueprintOptions' => $blueprint->options() // panel-view-extended
4136
];
37+
38+
if ($this->layout === 'table') {
39+
$item = $this->columnsValues($item, $page);
40+
}
41+
42+
$data[] = $item;
4243
}
44+
4345
return $data;
46+
47+
4448
}
4549
]
4650
];

0 commit comments

Comments
 (0)