1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
<?php /** * Base controller for global plugin configuration screens */ abstract class Loco_admin_config_BaseController extends Loco_mvc_AdminController {
/** * {@inheritdoc} */ public function init(){ parent::init(); // navigate between config view siblings, but only if privileged user if( current_user_can('manage_options') ){ $tabs = new Loco_admin_Navigation; $this->set( 'tabs', $tabs ); $actions = [ '' => __('Site options','loco-translate'), 'user' => __('User options','loco-translate'), 'apis' => __('API keys','loco-translate'), 'version' => __('Version','loco-translate'), 'debug' => __('System','loco-translate'), ]; $suffix = (string) $this->get('action'); foreach( $actions as $action => $name ){ $href = Loco_mvc_AdminRouter::generate( 'config-'.$action, $_GET ); $tabs->add( $name, $href, $action === $suffix ); } } }
/** * {@inheritdoc} */ public function getHelpTabs(){ return [ __('Overview','loco-translate') => $this->viewSnippet('tab-config'), __('API keys','loco-translate') => $this->viewSnippet('tab-config-apis'), ]; } }
|