public static function exportList($xml) { $attribs = BlockTypeList::getInstalledList(); $nxml = $xml->addChild('blocktypes'); foreach($attribs as $bt) { $type = $nxml->addChild('blocktype'); $type->addAttribute('handle', $bt->getBlockTypeHandle()); $type->addAttribute('package', $bt->getPackageHandle()); } }
/** * @param \Symfony\Component\Console\Input\InputInterface $input * @param \Symfony\Component\Console\Output\OutputInterface $output * * @return null|int null or 0 if everything went fine, or an error code */ public function generate(InputInterface $input, OutputInterface $output) { $output->writeln("# Core Block Types", ""); $types = \BlockTypeList::getInstalledList(); $output->writeln(array(" Handle | Name | Description ", " ------ | ---- | ----------- ")); foreach ($types as $type) { if (!$type->getPackageHandle()) { $handle = $type->getBlockTypeHandle(); $name = $type->getBlockTypeName(); $description = $type->getBlockTypeDescription(); $output->writeln("`{$handle}` | {$name} | {$description}"); } } }
public function view() { $btAvailableArray = BlockTypeList::getAvailableList(); $btInstalledArray = BlockTypeList::getInstalledList(); $internalBlockTypes = array(); $normalBlockTypes = array(); foreach($btInstalledArray as $_bt) { if ($_bt->isInternalBlockType()) { $internalBlockTypes[] = $_bt; } else { $normalBlockTypes[] = $_bt; } } $this->set('internalBlockTypes', $internalBlockTypes); $this->set('normalBlockTypes', $normalBlockTypes); $this->set('availableBlockTypes', $btAvailableArray); }
public function refresh_schema() { if ($this->upgrade_db) { $installDirectory = DIR_BASE_CORE . '/config'; $file = $installDirectory . '/db.xml'; if (!file_exists($file)) { throw new Exception(t('Unable to locate database import file.')); } $err = Package::installDB($file); // now we refresh the block schema $btl = new BlockTypeList(); $btArray = $btl->getInstalledList(); foreach ($btArray as $bt) { $bt->refresh(); } $this->upgrade_db = false; } }
$updates++; $localHandles[] = $_pkg->getPackageHandle(); } foreach($remote as $_pkg) { if (!in_array($_pkg->getPackageHandle(), $localHandles)) { $updates++; } } if ($tp->canInstallPackages()) { $pkgAvailableArray = Package::getAvailablePackages(); } $thisURL = $this->url('/dashboard/install'); $btArray = BlockTypeList::getInstalledList(); $btAvailableArray = BlockTypeList::getAvailableList(); $coreBlockTypes = array(); $webBlockTypes = array(); foreach($btArray as $_bt) { if ($_bt->getPackageID() == 0) { if ($_bt->isCoreBlockType()) { $coreBlockTypes[] = $_bt; } else { $webBlockTypes[] = $_bt; } } } $availableArray = array_merge($btAvailableArray, $pkgAvailableArray);