-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
28 lines (26 loc) · 820 Bytes
/
Copy pathbootstrap.php
File metadata and controls
28 lines (26 loc) · 820 Bytes
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
<?php
/**
* @file
* Cockpit Addon Collection Entries Filters config file.
*/
$this->module('collectionentriesfilters')->extend([
'loadFilters' => function() {
$entry = $this->app->storage->findOne('collectionentriesfilters');
return json_decode($entry['filters'], true);
},
'saveFilters' => function($filters) {
$existing = $this->app->storage->findOne('collectionentriesfilters');
$entry = ["filters" => json_encode($filters)];
if ($existing) {
$entry['_id'] = $existing['_id'];
$this->app->storage->save('collectionentriesfilters', $entry);
} else {
$this->app->storage->insert('collectionentriesfilters', $entry);
}
return ['success' => true];
}
]);
// Incldude admin.
if (COCKPIT_ADMIN && !COCKPIT_API_REQUEST) {
include_once __DIR__ . '/admin.php';
}