-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlugin.php
More file actions
144 lines (52 loc) · 1.71 KB
/
Copy pathPlugin.php
File metadata and controls
144 lines (52 loc) · 1.71 KB
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
<?php namespace Roojai\Blogs;
use System\Classes\PluginBase;
use Roojai\Blogs\Models\Blog;
use Roojai\Blogs\Models\Category;
use Event;
class Plugin extends PluginBase
{
public function registerComponents()
{
return [
'Roojai\Blogs\Components\Blogs'=>'blogs',
'Roojai\Blogs\Components\Singleblog'=>'singleblog',
'Roojai\Blogs\Components\Sidebarblogs'=>'sidebarblogs',
'Roojai\Blogs\Components\Singlecategory'=>'singlecategory'
];
}
public function registerPageSnippets()
{
return [
'Roojai\Blogs\Components\Blogs'=>'blogs'
];
}
public function registerSettings()
{
}
public function boot()
{
Event::listen('pages.menuitem.listTypes', function() {
return [
'roojaiblogs'=>'All Blogs',
'blogcategories'=>'Blog Categories'
];
});
Event::listen('pages.menuitem.getTypeInfo', function($type) {
if ($type == 'roojaiblogs'){
return Blog::getMenuTypeInfo($type);
} elseif($type == 'blogcategories'){
return Category::getMenuTypeInfo($type);
}
});
Event::listen('pages.menuitem.resolveItem', function($type, $item, $url, $theme) {
if ($type == 'roojaiblogs' ){
return Blog::resolveMenuItem($item, $url, $theme);
} elseif($type == 'blogcategories'){
return Category::resolveMenuItem($item, $url, $theme);
}
});
}
}