-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontroller.php
More file actions
executable file
·68 lines (53 loc) · 1.37 KB
/
controller.php
File metadata and controls
executable file
·68 lines (53 loc) · 1.37 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
<?php
namespace Concrete\Package\TmblocksDefault;
use Package;
use BlockType;
use SinglePage;
use PageTheme;
use BlockTypeSet;
use CollectionAttributeKey;
use Concrete\Core\Attribute\Type as AttributeType;
use Config;
use Core;
use AssetList;
defined('C5_EXECUTE') or die(_("Access Denied."));
class Controller extends Package
{
protected $pkgHandle = 'tmblocks-default';
protected $appVersionRequired = '5.7.5';
protected $pkgVersion = '1.0.0';
public function getPackageDescription()
{
return t("This package provides some default blocks using tmblocks.");
}
public function getPackageName()
{
return t("TRIGONmedia Default Blocks");
}
protected function installOrUpdateBlock($blockname, $pkg)
{
$bt = BlockType::getByHandle($blockname);
if (!is_object($bt)) {
BlockType::installBlockTypeFromPackage($blockname, $pkg);
}
}
protected function installOrUpdateBlocks($pkg)
{
if (!BlockTypeSet::getByHandle('tmblocks-default')) {
BlockTypeSet::add('tmblocks-default', "TMBlocks Default", $pkg);
}
$this->installOrUpdateBlock("tm_headline", $pkg);
$this->installOrUpdateBlock("tm_linklist", $pkg);
}
public function install()
{
$pkg = parent::install();
$this->installOrUpdateBlocks($pkg);
}
public function upgrade()
{
parent::upgrade();
$this->installOrUpdateBlocks($this);
}
}
?>