1 | <?php |
---|
2 | /** |
---|
3 | * @brief pages, a plugin for Dotclear 2 |
---|
4 | * |
---|
5 | * @package Dotclear |
---|
6 | * @subpackage Plugins |
---|
7 | * |
---|
8 | * @copyright Olivier Meunier & Association Dotclear |
---|
9 | * @copyright GPL-2.0-only |
---|
10 | */ |
---|
11 | |
---|
12 | if (!defined('DC_RC_PATH')) {return;} |
---|
13 | |
---|
14 | $core->addBehavior('initWidgets', ['pagesWidgets', 'initWidgets']); |
---|
15 | $core->addBehavior('initDefaultWidgets', ['pagesWidgets', 'initDefaultWidgets']); |
---|
16 | |
---|
17 | class pagesWidgets |
---|
18 | { |
---|
19 | public static function initWidgets($w) |
---|
20 | { |
---|
21 | $w->create('pages', __('Pages'), ['tplPages', 'pagesWidget'], null, 'List of published pages'); |
---|
22 | $w->pages->setting('title', __('Title (optional)') . ' :', __('Pages')); |
---|
23 | $w->pages->setting('homeonly', __('Display on:'), 1, 'combo', |
---|
24 | [ |
---|
25 | __('All pages') => 0, |
---|
26 | __('Home page only') => 1, |
---|
27 | __('Except on home page') => 2 |
---|
28 | ] |
---|
29 | ); |
---|
30 | $w->pages->setting('sortby', __('Order by:'), 'post_title', 'combo', |
---|
31 | [ |
---|
32 | __('Page title') => 'post_title', |
---|
33 | __('Page position') => 'post_position', |
---|
34 | __('Publication date') => 'post_dt' |
---|
35 | ] |
---|
36 | ); |
---|
37 | $w->pages->setting('orderby', __('Sort:'), 'asc', 'combo', |
---|
38 | [__('Ascending') => 'asc', __('Descending') => 'desc'] |
---|
39 | ); |
---|
40 | $w->pages->setting('content_only', __('Content only'), 0, 'check'); |
---|
41 | $w->pages->setting('class', __('CSS class:'), ''); |
---|
42 | $w->pages->setting('offline', __('Offline'), 0, 'check'); |
---|
43 | } |
---|
44 | |
---|
45 | public static function initDefaultWidgets($w, $d) |
---|
46 | { |
---|
47 | $d['nav']->append($w->pages); |
---|
48 | } |
---|
49 | } |
---|