-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathProfileModulePlugin.php
More file actions
62 lines (54 loc) · 1.85 KB
/
Copy pathProfileModulePlugin.php
File metadata and controls
62 lines (54 loc) · 1.85 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
55
56
57
58
59
60
61
62
<?php namespace Visiosoft\ProfileModule;
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
use Visiosoft\ProfileModule\Adress\Command\GetAddress;
use Visiosoft\ProfileModule\Adress\Command\GetAddressByUser;
use Visiosoft\ProfileModule\Profile\Command\GetProfileDetail;
use Visiosoft\ProfileModule\Profile\Command\GetProfilePhotoURL;
use Visiosoft\ProfileModule\Profile\Command\UserInitials;
class ProfileModulePlugin extends Plugin
{
public function getFunctions()
{
return [
new \Twig_SimpleFunction(
'getAddress',
function ($id) {
if (!$ad = $this->dispatchSync(new GetAddress($id))) {
return null;
}
return $ad;
}
),
new \Twig_SimpleFunction(
'getAddressByUser',
function ($user_id) {
if (!$ad = $this->dispatchSync(new GetAddressByUser($user_id))) {
return null;
}
return $ad;
}
),
new \Twig_SimpleFunction(
'getProfileDetail',
function ($user_id) {
if (!$ad = $this->dispatchSync(new GetProfileDetail($user_id))) {
return null;
}
return $ad;
}
),
new \Twig_SimpleFunction(
'profilePhoto',
function ($user) {
return $this->dispatchSync(new GetProfilePhotoURL($user));
}
),
new \Twig_SimpleFunction(
'user_initials',
function ($user) {
return $this->dispatchSync(new UserInitials($user));
}
),
];
}
}