-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontroller.php
More file actions
78 lines (55 loc) · 2.04 KB
/
Copy pathcontroller.php
File metadata and controls
78 lines (55 loc) · 2.04 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
namespace Concrete\Package\RegisterSubscribeSendy;
use Database;
use Package;
use SinglePage;
use Core;
use Events;
use Concrete\Core\Attribute\Category\CategoryService;
use Concrete\Core\Attribute\Key\Category as AttributeKeyCategory;
use Concrete\Core\Attribute\Type as AttributeType;
use AttributeSet;
use Concrete\Core\Entity\Attribute\Set;
use Concrete\Core\Entity\Attribute;
use Concrete\Core\Attribute\SetFactory;
use User;
use Concrete\Core\Entity\Attribute\Key\UserKey;
class Controller extends Package {
protected $pkgHandle = 'register_subscribe_sendy';
protected $appVersionRequired = '5.7.5';
protected $pkgVersion = '0.4';
public function getPackageDescription () {
return t("Offer subscription to a Sendy List on User Registration");
}
public function getPackageName () {
return t("Register - Subscribe to Sendy");
}
public function install () {
$pkg = parent::install();
SinglePage::add('/dashboard/subscribe',$pkg);
$service = $this->app->make('Concrete\Core\Attribute\Category\CategoryService');
$categoryEntity = $service->getByHandle('collection');
$category = $categoryEntity->getController();
$key = $category->getByHandle('register_subscribe');
if (!is_object($key)) {
$key = new UserKey();
$key->setAttributeKeyHandle('register_subscribe');
$key->setAttributeKeyName('Subscribe on Register');
$key->setAttributeKeyEditableOnRegister(true);
$key = $category->add('boolean', $key, null, $pkg);
}
}
public function uninstall(){
$pkg = parent::uninstall();
}
public function upgrade () {
$pkg =parent::upgrade();
$pkg = Package::getByHandle($this->pkgHandle);
}
public function on_start()
{
require $this->getPackagePath() . '/vendor/autoload.php';
$event = Core::make('\Concrete\Package\RegisterSubscribeSendy\Src\Subscribe');
Events::addListener('on_user_validate', array($event, 'userAdd'));
}
}