public function install()
 {
     $pkg = parent::install();
     $bt = BlockType::getByHandle('redirect');
     if (!is_object($bt)) {
         $bt = BlockType::installBlockType('redirect', $pkg);
     }
     $bts = \BlockTypeSet::getByHandle('navigation');
     if ($bts) {
         if (!$bts->contains($bt)) {
             $bts->addBlockType($bt);
         }
     }
 }
예제 #2
0
<?php

defined('C5_EXECUTE') or die("Access Denied.");
$sets = BlockTypeSet::getList();
$types = array();
foreach ($blockTypes as $bt) {
    if (!$cp->canAddBlockType($bt)) {
        continue;
    }
    $btsets = $bt->getBlockTypeSets();
    foreach ($btsets as $set) {
        $types[$set->getBlockTypeSetName()][] = $bt;
    }
    if (count($btsets) == 0) {
        $types['Other'][] = $bt;
    }
}
for ($i = 0; $i < count($sets); $i++) {
    $set = $sets[$i];
    ?>

<div class="ccm-ui" id="ccm-add-block-list">

<section>
    <legend><?php 
    echo $set->getBlockTypeSetDisplayName();
    ?>
</legend>
    <ul class="item-select-list">
        <?php 
    $blockTypes = isset($types[$set->getBlockTypeSetName()]) ? $types[$set->getBlockTypeSetName()] : array();