Dotclear

source: plugins/breadcrumb/_admin.php @ 3333:11107ba2fc59

Revision 3333:11107ba2fc59, 1.8 KB checked in by franck <carnet.franck.paul@…>, 9 years ago (diff)

Cope with settings URLs for modules (defined in _define.php).
The settings URLs are displayed on the plugins maganement page, and at the bottom of each plugin main page if any (index.php).

The URLs are set in _define.php, as a new property using this schema:

'settings' => array( <list of URLs> )

With:

<list of URLs> = '<type>' => '<location>', …
<type> = 'self' (own plugin page), 'blog' (in blog parameters page) or 'pref' (in user preferences page)
<location> = (empty) or #<tab>[.<id>] with <tab> = id of the corresponding tab, and <id> = id of fieldset, h4, h5, field, … of first corresponding field

The list of URLs are displayed in the order defined in the array above.

Examples:

Antispam plugin:

'settings' => array(

'self' => ,
'blog' => '#params.antispam_params'

)

self → for main settings of the plugin on its own page (index.php)
blog → for secondary settings in the blog parameters

Tags plugin:

'settings' => array(

'pref' => '#user-options.tags_prefs'

)

pref → for tags list format in user preferences

Maintenance plugin:

'settings' => array(

'self' => '#settings'

)

self → "settings" tab of its own page (index.php)

  • Property exe set to *
Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3# This file is part of breadcrumb, a plugin for Dotclear 2.
4#
5# Copyright (c) Franck Paul and contributors
6# carnet.franck.paul@gmail.com
7#
8# Licensed under the GPL version 2.0 license.
9# A copy of this license is available in LICENSE file or at
10# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11# -- END LICENSE BLOCK ------------------------------------
12
13if (!defined('DC_CONTEXT_ADMIN')) { return; }
14
15// dead but useful code, in order to have translations
16__('Breadcrumb').__('Breadcrumb for Dotclear');
17
18$core->addBehavior('adminBlogPreferencesForm',array('breadcrumbBehaviors','adminBlogPreferencesForm'));
19$core->addBehavior('adminBeforeBlogSettingsUpdate',array('breadcrumbBehaviors','adminBeforeBlogSettingsUpdate'));
20
21class breadcrumbBehaviors
22{
23     public static function adminBlogPreferencesForm($core,$settings)
24     {
25          $settings->addNameSpace('breadcrumb');
26          echo
27          '<div class="fieldset"><h4 id="breadcrumb_params">'.__('Breadcrumb').'</h4>'.
28          '<p><label class="classic">'.
29          form::checkbox('breadcrumb_enabled','1',$settings->breadcrumb->breadcrumb_enabled).
30          __('Enable breadcrumb for this blog').'</label></p>'.
31          '<p class="form-note">'.__('The {{tpl:Breadcrumb [separator=" &amp;rsaquo; "]}} tag should be present (or inserted if not) in the template.').'</p>'.
32          form::checkbox('breadcrumb_alone','1',$settings->breadcrumb->breadcrumb_alone).
33          __('Do not encapsulate breadcrumb in a &lt;p id="breadcrumb"&gt;...&lt;/p&gt; tag.').'</label></p>'.
34          '</div>';
35     }
36
37     public static function adminBeforeBlogSettingsUpdate($settings)
38     {
39          $settings->addNameSpace('breadcrumb');
40          $settings->breadcrumb->put('breadcrumb_enabled',!empty($_POST['breadcrumb_enabled']),'boolean');
41          $settings->breadcrumb->put('breadcrumb_alone',!empty($_POST['breadcrumb_alone']),'boolean');
42     }
43}
Note: See TracBrowser for help on using the repository browser.

Sites map