-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTeamManagerPlugin.php
55 lines (44 loc) · 1.09 KB
/
TeamManagerPlugin.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
<?php
namespace Craft;
class TeamManagerPlugin extends BasePlugin
{
public function getName()
{
return 'Team Manager';
}
public function getVersion()
{
return '0.1';
}
public function getDeveloper()
{
return 'Kirill Toropov';
}
public function getDeveloperUrl()
{
return 'http://toro.ninja/';
}
public function hasCpSection()
{
return true;
}
public function registerCpRoutes()
{
return array(
'teammanager\/teams\/new' => 'teammanager/teams/_edit',
'teammanager\/teams\/(?P<teamId>\d+)' => 'teammanager/teams/_edit',
);
}
public function onAfterInstall()
{
}
public function init()
{
parent::init();
craft()->on('sections.onSaveEntryType', function (Event $event) {
if ($event->params['entryType']->handle == 'structure')
foreach (craft()->teamManager->getAllTeams() as $team)
$team->updateEntryType($event->params['entryType']->fieldLayoutId);
});
}
}