-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDefaultChildThemePlugin.inc.php
79 lines (65 loc) · 2.07 KB
/
DefaultChildThemePlugin.inc.php
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* @file plugins/themes/default/DefaultChildThemePlugin.inc.php
*
* Copyright (c) 2014-2016 Simon Fraser University Library
* Copyright (c) 2003-2016 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @class DefaultChildThemePlugin
* @ingroup plugins_themes_default
*
* @brief Default theme
*/
import('lib.pkp.classes.plugins.ThemePlugin');
define('UNIREDE_LOGO_URL', 'images/logo_unirede.png');
define('CREATIVE_COMMONS_LOGO_URL', 'images/cc_logo.png');
class DefaultChildThemePlugin extends ThemePlugin {
/**
* Initialize the theme's styles, scripts and hooks. This is only run for
* the currently active theme.
*
* @return null
*/
public function init() {
HookRegistry::register('TemplateManager::display', array($this, 'loadAdditionalData'));
$this->setParent('defaultthemeplugin');
$this->addStyle('child-stylesheet', 'styles/emRede.less');
$this->addStyle('editorial-stylesheet', 'styles/emRedeEditorial.less', array( 'contexts' => 'backend' ));
}
/**
* Get the display name of this plugin
* @return string
*/
function getDisplayName() {
return __('plugins.themes.default-child.name');
}
/**
* Get the description of this plugin
* @return string
*/
function getDescription() {
return __('plugins.themes.default-child.description');
}
public function loadAdditionalData($hookName, $args) {
$smarty = $args[0];
$request = Application::getRequest();
$context = $request->getContext();
if (!defined('SESSION_DISABLE_INIT')) {
// Get possible locales
if ($context) {
$locales = $context->getSupportedLocaleNames();
} else {
$locales = $request->getSite()->getSupportedLocaleNames();
}
$uniredeLogoUrl = "/". $this->getPluginPath() . '/' . UNIREDE_LOGO_URL;
$creativeCommonsLogoUrl = "/". $this->getPluginPath() . '/' . CREATIVE_COMMONS_LOGO_URL;
$smarty->assign(array(
'languageToggleLocales' => $locales,
'uniredeLogoUrl' => $uniredeLogoUrl,
'creativeCommonsLogoUrl' => $creativeCommonsLogoUrl,
));
}
}
}
?>