Dotclear

source: plugins/blogroll/_widgets.php @ 904:f1fd70475361

Revision 904:f1fd70475361, 1.3 KB checked in by franck <carnet.franck.paul@…>, 13 years ago (diff)

Add class attribute (applied to encapsulated div) for standard widgets - Fixes #1230

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ---------------------------------------
3#
4# This file is part of Dotclear 2.
5#
6# Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear
7# Licensed under the GPL version 2.0 license.
8# See LICENSE file or
9# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10#
11# -- END LICENSE BLOCK -----------------------------------------
12if (!defined('DC_RC_PATH')) { return; }
13
14$core->addBehavior('initWidgets',array('blogrollWidgets','initWidgets'));
15$core->addBehavior('initDefaultWidgets',array('blogrollWidgets','initDefaultWidgets'));
16
17class blogrollWidgets
18{
19     public static function initWidgets($w)
20     {
21          $w->create('links',__('Blogroll'),array('tplBlogroll','linksWidget'));
22          $w->links->setting('title',__('Title:'),__('Links'));
23         
24          $br = new dcBlogroll($GLOBALS['core']->blog);
25          $h = $br->getLinksHierarchy($br->getLinks());
26          $h = array_keys($h);
27          $categories = array(__('All categories') => '');
28          foreach ($h as $v) {
29               if ($v) {
30                    $categories[$v] = $v;
31               }
32          }
33          unset($br,$h);
34          $w->links->setting('category',__('Category'),'','combo',$categories);
35         
36          $w->links->setting('homeonly',__('Home page only'),1,'check');
37          $w->links->setting('class',__('CSS class:'),'');
38     }
39     
40     public static function initDefaultWidgets($w,$d)
41     {
42          $d['extra']->append($w->links);
43     }
44}
45?>
Note: See TracBrowser for help on using the repository browser.

Sites map