Dotclear

source: plugins/pages/_widgets.php @ 3874:ab8368569446

Revision 3874:ab8368569446, 1.6 KB checked in by franck <carnet.franck.paul@…>, 7 years ago (diff)

short notation for array (array() → [])

RevLine 
[0]1<?php
[3731]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
[3730]12if (!defined('DC_RC_PATH')) {return;}
[0]13
[3874]14$core->addBehavior('initWidgets', ['pagesWidgets', 'initWidgets']);
15$core->addBehavior('initDefaultWidgets', ['pagesWidgets', 'initDefaultWidgets']);
[0]16
17class pagesWidgets
18{
[3730]19    public static function initWidgets($w)
20    {
[3874]21        $w->create('pages', __('Pages'), ['tplPages', 'pagesWidget'], null, 'List of published pages');
[3730]22        $w->pages->setting('title', __('Title (optional)') . ' :', __('Pages'));
23        $w->pages->setting('homeonly', __('Display on:'), 1, 'combo',
[3874]24            [
[3730]25                __('All pages')           => 0,
26                __('Home page only')      => 1,
27                __('Except on home page') => 2
[3874]28            ]
[3730]29        );
30        $w->pages->setting('sortby', __('Order by:'), 'post_title', 'combo',
[3874]31            [
[3730]32                __('Page title')       => 'post_title',
33                __('Page position')    => 'post_position',
34                __('Publication date') => 'post_dt'
[3874]35            ]
[3730]36        );
37        $w->pages->setting('orderby', __('Sort:'), 'asc', 'combo',
[3874]38            [__('Ascending') => 'asc', __('Descending') => 'desc']
[3730]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    }
[2566]44
[3730]45    public static function initDefaultWidgets($w, $d)
46    {
47        $d['nav']->append($w->pages);
48    }
[0]49}
Note: See TracBrowser for help on using the repository browser.

Sites map