-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroller.php
More file actions
35 lines (25 loc) · 884 Bytes
/
controller.php
File metadata and controls
35 lines (25 loc) · 884 Bytes
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
<?php defined('C5_EXECUTE') or die("Access Denied.");
class ApiBaseExamplePackage extends Package {
protected $pkgHandle = 'api_base_example';
protected $appVersionRequired = '5.6.0';
protected $pkgVersion = '1.0';
public function getPackageName() {
return t("Api:Base:Example");
}
public function getPackageDescription() {
return t("API Package Example.");
}
public function install() {
$installed = Package::getByHandle('api');
if(!is_object($installed)) {
throw new Exception(t('Please install the "API" package before installing %s', $this->getPackageName()));
}
parent::install();
$pkg = Package::getByHandle($this->pkgHandle);
ApiRoute::add('hello', t('This route does nothing, its only a test!'), $pkg);
}
public function uninstall() {
ApiRouteList::removeByPackage($this->pkgHandle);//remove all the apis
parent::uninstall();
}
}