summaryrefslogtreecommitdiff
path: root/start.php
blob: 62600757810957ceb1e1cfcec784fce275ae3cf4 (plain)
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
<?php

elgg_register_event_handler('init', 'system', 'n1_theme_init');

function n1_theme_init() {
	elgg_unregister_menu_item('topbar','elgg_logo');
	$item =  new ElggMenuItem('site_logo', elgg_get_site_entity()->name, elgg_get_site_url());
	elgg_register_menu_item('topbar', $item);
	elgg_register_plugin_hook_handler('register', 'menu:topbar', 'n1_theme_topbar_menu');
	
	elgg_register_simplecache_view('n1_theme/landing');
	elgg_register_css('n1:landing_page', elgg_get_simplecache_url('css', 'n1_theme/landing'));
	
	elgg_extend_view('css/elgg', 'n1_theme/css');
	elgg_extend_view('js/elgg', 'n1_theme/js');
	elgg_extend_view('page/elements/title', 'n1_theme/header', 0);
	
	if (elgg_is_active_plugin('pages')) {
		// pages icon url override
		elgg_register_plugin_hook_handler('entity:icon:url', 'object', 'n1_theme_pages_icon_url_override');
	}
}

function n1_theme_topbar_menu($hook, $type, $returnvalue, $params){
	//var_dump($returnvalue);exit();
}

/**
 * Override the default entity icon for pages and pads
 *
 * @return string Relative URL
 */
function n1_theme_pages_icon_url_override($hook, $type, $returnvalue, $params) {
	$entity = $params['entity'];
	if (elgg_instanceof($entity, 'object', 'page_top') ||
		elgg_instanceof($entity, 'object', 'page')) {
		$icon = 'pages';
	} elseif (elgg_instanceof($entity, 'object', 'etherpad') ||
			  elgg_instanceof($entity, 'object', 'subpad')) {
		$icon = 'pad';
	} else {
		return $returnvalue;
	}
	switch ($params['size']) {
		case 'topbar':
		case 'tiny':
			return "mod/n1_theme/_graphics/icons/{$icon}_tiny.gif";
			break;
		case 'small':
			return "mod/n1_theme/_graphics/icons/{$icon}_small.gif";
			break;
		default:
			return "mod/n1_theme/_graphics/icons/{$icon}_lrg.gif";
			break;
	}
}