-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPlugin.php
85 lines (78 loc) · 2.4 KB
/
Plugin.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
80
81
82
83
84
85
<?php namespace PKleindienst\GithubProjects;
use System\Classes\PluginBase;
class Plugin extends PluginBase
{
/**
* Returns information about this plugin.
*
* @return array
*/
public function pluginDetails()
{
return [
'name' => 'pkleindienst.githubprojects::lang.plugin.name',
'description' => 'pkleindienst.githubprojects::lang.plugin.description',
'author' => 'Pascal Kleindienst',
'icon' => 'icon-github',
'homepage' => 'https://github.com/PascalKleindienst/octobercms-github-projects'
];
}
/**
* @return array
*/
public function registerComponents()
{
return [
'PKleindienst\GithubProjects\Components\Item' => 'ghItem',
'PKleindienst\GithubProjects\Components\RepoList' => 'ghList',
'PKleindienst\GithubProjects\Components\Gist' => 'ghGist'
];
}
/**
* Register new Twig variables
* @return array
*/
public function registerMarkupTags()
{
// Check the translate plugin is installed
if (class_exists('RainLab\Translate\Behaviors\TranslatableModel')) {
return ['filters' => [
'cast_to_array' => [$this, 'castToArray']
]];
}
return [
'filters' => [
'_' => ['Lang', 'get'],
'__' => ['Lang', 'choice'],
'cast_to_array' => [$this, 'castToArray']
]
];
}
/**
* Register settings
* @return array
*/
public function registerSettings()
{
return [
'githubprojects' => [
'label' => 'pkleindienst.githubprojects::lang.plugin.name',
'description' => 'pkleindienst.githubprojects::lang.settings.description',
'icon' => 'icon-github',
'class' => 'PKleindienst\GithubProjects\Models\Settings',
'order' => 500,
'keywords' => 'geography place placement',
'permissions' => ['acme.users.access_settings']
]
];
}
/**
* Markup Tag to cast an object to an array
* @param mixed $stdClassObject
* @return array
*/
public function castToArray($stdClassObject)
{
return (array)$stdClassObject;
}
}