Elgg
Version master
engine
classes
Elgg
Page
AddColorSchemeHandler.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Elgg\Page
;
4
10
class
AddColorSchemeHandler
{
11
19
public
function
__invoke
(\
Elgg
\
Event
$event): ?array {
20
if
(!
elgg_get_config
(
'color_schemes_enabled'
)) {
21
return
null
;
22
}
23
24
$vars
= $event->getValue();
25
26
if
(
elgg_in_context
(
'admin'
)) {
27
// @todo make admin backend support color schemes
28
$vars
[
'html_attrs'
][
'data-color-scheme'
] =
'default'
;
29
30
return
$vars
;
31
}
32
33
$color_scheme =
elgg_get_logged_in_user_entity
()?->elgg_color_scheme;
34
if
(!isset($color_scheme) || $color_scheme ===
'browser'
) {
35
return
null
;
36
}
37
38
$vars
[
'html_attrs'
][
'data-color-scheme'
] = $color_scheme;
39
40
return
$vars
;
41
}
42
}
$vars
$vars
Definition:
theme.php:3
Elgg\Event
Models an event passed to event handlers.
Definition:
Event.php:11
Elgg\Page\AddColorSchemeHandler
Add color scheme information to page html.
Definition:
AddColorSchemeHandler.php:10
Elgg\Page\AddColorSchemeHandler\__invoke
__invoke(\Elgg\Event $event)
Add color scheme information to page html.
Definition:
AddColorSchemeHandler.php:19
elgg_get_config
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
Definition:
configuration.php:136
elgg_in_context
elgg_in_context(string $context)
Check if this context exists anywhere in the stack.
Definition:
context.php:78
Elgg\Page
Definition:
AddColorSchemeHandler.php:3
Elgg
Definition:
ActionsService.php:3
if
if(parse_url(elgg_get_site_url(), PHP_URL_PATH) !=='/') if(file_exists(elgg_get_root_path() . 'robots.txt'))
Set robots.txt.
Definition:
robots.php:10
elgg_get_logged_in_user_entity
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
Definition:
sessions.php:24
Generated on Tue Jun 2 2026 00:02:03 for Elgg by
1.9.1