1: <?php
2: /*
3: You may not change or alter any portion of this comment or credits
4: of supporting developers from this source code or any supporting source code
5: which is considered copyrighted (c) material of the original comment or credit authors.
6:
7: This program is distributed in the hope that it will be useful,
8: but WITHOUT ANY WARRANTY; without even the implied warranty of
9: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: */
11:
12: /**
13: * @copyright XOOPS Project (http://xoops.org)
14: * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
15: * @author trabis <lusopoemas@gmail.com>
16: * @version $Id$
17: */
18:
19: class CodexUserconfigsPlugin extends Xoops\Module\Plugin\PluginAbstract implements UserconfigsPluginInterface
20: {
21: /**
22: * Expects an array of arrays containing:
23: * name, Name of the category
24: * description, Description for the category, use constant
25: * The keys must be unique identifiers
26: */
27: public function categories()
28: {
29: $categories['cat_1']['name'] = _MI_CODEX_UCONF_CAT1;
30: $categories['cat_1']['title'] = _MI_CODEX_UCONF_CAT1_DSC;
31: $categories['cat_2']['name'] = _MI_CODEX_UCONF_CAT2;
32: $categories['cat_2']['title'] = _MI_CODEX_UCONF_CAT2_DSC;
33: return $categories;
34: }
35:
36: /**
37: * Expects an array of arrays containing:
38: * name, Name of the config
39: * title, Display name for the config, use constant
40: * description, Description for the config, use constant
41: * formtype, Form to use for the config
42: * default, Default value for the config
43: * options, Options available for the config
44: * category, Category for this config, use the unique identifier set on categories()
45: */
46: public function configs()
47: {
48: $i = 0;
49: $config[$i]['name'] = 'config_1';
50: $config[$i]['title'] = '_MI_CODEX_UCONF_ITEM1';
51: $config[$i]['description'] = '_MI_CODEX_UCONF_ITEM1_DSC';
52: $config[$i]['formtype'] = 'select';
53: $config[$i]['valuetype'] = 'int';
54: $config[$i]['default'] = 1;
55: $config[$i]['options'] = array_flip(array('Option 1', 'Option 2'));
56: $config[$i]['category'] = 'cat_1';
57: ++$i;
58: $config[$i]['name'] = 'config_2';
59: $config[$i]['title'] = '_MI_CODEX_UCONF_ITEM2';
60: $config[$i]['description'] = '_MI_CODEX_UCONF_ITEM2_DSC';
61: $config[$i]['formtype'] = 'text';
62: $config[$i]['valuetype'] = 'text';
63: $config[$i]['default'] = 'Type Something here';
64: $config[$i]['category'] = 'cat_2';
65: return $config;
66: }
67: }
68: