-
Notifications
You must be signed in to change notification settings - Fork 3
/
injector.php
52 lines (49 loc) · 1.4 KB
/
injector.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
<?php
class com_meego_planet_injector
{
public function inject_process(midgardmvc_core_request $request)
{
static $connected = false;
if ($connected)
{
return;
}
// Subscribe to content changed signals from Midgard
midgard_object_class::connect_default
(
'com_meego_planet_feed',
'action-delete-hook',
function($feed)
{
array_walk
(
com_meego_planet_utils::get_items_for_feed($feed),
function ($item)
{
$item->delete();
}
);
}
);
$connected = true;
}
/**
* Add our own stuff to the templates
*/
public function inject_template(midgardmvc_core_request $request)
{
// Replace the default MeeGo sidebar with our own
$route = $request->get_route();
$route->template_aliases['content-sidebar'] = 'cmp-show-sidebar';
$route->template_aliases['main-menu'] = 'cmp-show-main_menu';
midgardmvc_core::get_instance()->head->add_link
(
array
(
'rel' => 'stylesheet',
'type' => 'text/css',
'href' => MIDGARDMVC_STATIC_URL . '/com_meego_planet/planet.css'
)
);
}
}