public function import(\SimpleXMLElement $sx)
 {
     if (isset($sx->blocktypesets)) {
         foreach ($sx->blocktypesets->blocktypeset as $bts) {
             $pkg = static::getPackageObject($bts['package']);
             $set = Set::getByHandle((string) $bts['handle']);
             if (!is_object($set)) {
                 $set = Set::add((string) $bts['handle'], (string) $bts['name'], $pkg);
             }
             foreach ($bts->children() as $btk) {
                 $bt = BlockType::getByHandle((string) $btk['handle']);
                 if (is_object($bt)) {
                     $set->addBlockType($bt);
                 }
             }
         }
     }
 }
 public function execute(Batch $batch)
 {
     $sets = $batch->getObjectCollection('block_type_set');
     if (!$sets) {
         return;
     }
     foreach ($sets->getSets() as $set) {
         if (!$set->getPublisherValidator()->skipItem()) {
             $pkg = null;
             if ($set->getPackage()) {
                 $pkg = \Package::getByHandle($set->getPackage());
             }
             $set = Set::add($set->getHandle(), $set->getName(), $pkg);
             $types = $set->getTypes();
             foreach ($types as $handle) {
                 $bt = BlockType::getByHandle($handle);
                 if (is_object($bt)) {
                     $set->addBlockType($bt);
                 }
             }
         }
     }
 }
 protected function addBlockTypes()
 {
     $this->output(t('Adding block types...'));
     $desktopSet = \Concrete\Core\Block\BlockType\Set::getByHandle('core_desktop');
     if (!is_object($desktopSet)) {
         $desktopSet = \Concrete\Core\Block\BlockType\Set::add('core_desktop', 'Desktop');
     }
     $expressSet = \Concrete\Core\Block\BlockType\Set::getByHandle('express');
     if (!is_object($expressSet)) {
         $expressSet = \Concrete\Core\Block\BlockType\Set::add('express', 'Express');
     }
     $formSet = \Concrete\Core\Block\BlockType\Set::getByHandle('form');
     if (!is_object($formSet)) {
         $formSet = \Concrete\Core\Block\BlockType\Set::add('form', 'Forms');
     }
     $bt = BlockType::getByHandle('express_form');
     if (!is_object($bt)) {
         $bt = BlockType::installBlockType('express_form');
     }
     $formSet->addBlockType($bt);
     $bt = BlockType::getByHandle('express_entry_list');
     if (!is_object($bt)) {
         $bt = BlockType::installBlockType('express_entry_list');
     }
     $expressSet->addBlockType($bt);
     $bt = BlockType::getByHandle('express_entry_detail');
     if (!is_object($bt)) {
         $bt = BlockType::installBlockType('express_entry_detail');
     }
     $expressSet->addBlockType($bt);
     $bt = BlockType::getByHandle('dashboard_site_activity');
     if (is_object($bt)) {
         $bt->delete();
     }
     $bt = BlockType::getByHandle('dashboard_app_status');
     if (is_object($bt)) {
         $bt->delete();
     }
     $bt = BlockType::getByHandle('dashboard_featured_theme');
     if (is_object($bt)) {
         $bt->delete();
     }
     $bt = BlockType::getByHandle('dashboard_featured_addon');
     if (is_object($bt)) {
         $bt->delete();
     }
     $bt = BlockType::getByHandle('dashboard_newsflow_latest');
     if (is_object($bt)) {
         $bt->delete();
     }
     $bt = BlockType::getByHandle('desktop_site_activity');
     if (!is_object($bt)) {
         $bt = BlockType::installBlockType('desktop_site_activity');
     }
     $desktopSet->addBlockType($bt);
     $bt = BlockType::getByHandle('desktop_app_status');
     if (!is_object($bt)) {
         $bt = BlockType::installBlockType('desktop_app_status');
     }
     $desktopSet->addBlockType($bt);
     $bt = BlockType::getByHandle('desktop_featured_theme');
     if (!is_object($bt)) {
         $bt = BlockType::installBlockType('desktop_featured_theme');
     }
     $desktopSet->addBlockType($bt);
     $bt = BlockType::getByHandle('desktop_featured_addon');
     if (!is_object($bt)) {
         $bt = BlockType::installBlockType('desktop_featured_addon');
     }
     $desktopSet->addBlockType($bt);
     $bt = BlockType::getByHandle('desktop_newsflow_latest');
     if (!is_object($bt)) {
         $bt = BlockType::installBlockType('desktop_newsflow_latest');
     }
     $desktopSet->addBlockType($bt);
     $bt = BlockType::getByHandle('desktop_latest_form');
     if (!is_object($bt)) {
         $bt = BlockType::installBlockType('desktop_latest_form');
     }
     $desktopSet->addBlockType($bt);
     $bt = BlockType::getByHandle('desktop_waiting_for_me');
     if (!is_object($bt)) {
         $bt = BlockType::installBlockType('desktop_waiting_for_me');
     }
     $desktopSet->addBlockType($bt);
     $bt = BlockType::getByHandle('desktop_waiting_for_me');
     if (!is_object($bt)) {
         $bt = BlockType::installBlockType('desktop_waiting_for_me');
     }
     $desktopSet->addBlockType($bt);
     $bt = BlockType::getByHandle('page_title');
     if (is_object($bt)) {
         $bt->refresh();
     }
     $bt = BlockType::getByHandle('page_list');
     if (is_object($bt)) {
         $bt->refresh();
     }
     $bt = BlockType::getByHandle('next_previous');
     if (is_object($bt)) {
         $bt->refresh();
     }
     $bt = BlockType::getByHandle('autonav');
     if (is_object($bt)) {
         $bt->refresh();
     }
 }
Example #4
0
 protected function run_install($pkg)
 {
     $db = Loader::db();
     BlockTypeSet::add('commerce', 'Commerce', $pkg);
     $db->Execute('update BlockTypeSets set btsDisplayOrder = 1 where btsHandle != "commerce"');
 }