-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Expand file tree
/
Copy pathViewBlockDefaults.php
More file actions
133 lines (128 loc) · 4.19 KB
/
Copy pathViewBlockDefaults.php
File metadata and controls
133 lines (128 loc) · 4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
namespace BookStack\View;
class ViewBlockDefaults
{
/**
* @var array<string, array<string, class-string<ViewBlockInterface>[]>>
*/
protected static array $defaults = [
'home-default' => [
'left' => [
ViewBlocks\HomeRecentDrafts::class,
ViewBlocks\HomeRecentlyViewedOrRecentBooks::class,
],
'center' => [
ViewBlocks\HomeTopFavourites::class,
ViewBlocks\HomeRecentlyUpdatedPages::class,
],
'right' => [
ViewBlocks\HomeRecentActivity::class,
],
],
'home-non-default' => [
'left' => [
ViewBlocks\HomeRecentDrafts::class,
ViewBlocks\HomeTopFavourites::class,
ViewBlocks\HomeRecentlyViewedOrRecentBooks::class,
ViewBlocks\HomeRecentlyUpdatedPages::class,
ViewBlocks\HomeRecentActivity::class,
],
'right' => [
ViewBlocks\HomeActions::class,
],
],
'shelves-index' => [
'left' => [
ViewBlocks\ShelvesIndexRecents::class,
ViewBlocks\ShelvesIndexPopular::class,
ViewBlocks\ShelvesIndexNew::class,
],
'right' => [
ViewBlocks\ShelvesIndexActions::class,
],
],
'shelves-show' => [
'left' => [
ViewBlocks\ShelvesShowTags::class,
ViewBlocks\ShelvesShowDetails::class,
ViewBlocks\ShelvesShowActivity::class,
],
'right' => [
ViewBlocks\ShelvesShowActions::class,
],
],
'books-index' => [
'left' => [
ViewBlocks\BooksIndexRecents::class,
ViewBlocks\BooksIndexPopular::class,
ViewBlocks\BooksIndexNew::class,
],
'right' => [
ViewBlocks\BooksIndexActions::class,
],
],
'books-show' => [
'left' => [
ViewBlocks\BooksShowSearchForm::class,
ViewBlocks\BooksShowTags::class,
ViewBlocks\BooksShowShelves::class,
ViewBlocks\BooksShowActivity::class,
],
'right' => [
ViewBlocks\BooksShowDetails::class,
ViewBlocks\BooksShowActions::class,
],
],
'chapters-show' => [
'left' => [
ViewBlocks\ChaptersShowSearchForm::class,
ViewBlocks\ChaptersShowTags::class,
ViewBlocks\ChaptersShowBookTree::class,
],
'right' => [
ViewBlocks\ChaptersShowDetails::class,
ViewBlocks\ChaptersShowActions::class,
],
],
'pages-show' => [
'left' => [
ViewBlocks\PagesShowTags::class,
ViewBlocks\PagesShowAttachments::class,
ViewBlocks\PagesShowPageNav::class,
ViewBlocks\PagesShowBookTree::class,
],
'right' => [
ViewBlocks\PagesShowDetails::class,
ViewBlocks\PagesShowActions::class,
],
],
];
/**
* Get the default view blocks for the given location.
*/
public static function getForLocation(string $location): array
{
return self::$defaults[$location] ?? [];
}
/**
* Get the locations for all default blocks.
* @return string[]
*/
public static function getLocations(): array
{
return array_keys(self::$defaults);
}
public static function getLocationLabels(): array
{
return [
'home-default' => trans('common.homepage'),
'home-non-default' => trans('common.homepage'),
'shelves-index' => trans('entities.shelves'),
'shelves-show' => trans('entities.shelf'),
'books-index' => trans('entities.books'),
'books-show' => trans('entities.book'),
'chapters-show' => trans('entities.chapter'),
'pages-show' => trans('entities.page'),
];
}
}