public function import(\SimpleXMLElement $sx) { if (isset($sx->blocktypes)) { foreach ($sx->blocktypes->blocktype as $bt) { if (!is_object(BlockType::getByHandle((string) $bt['handle']))) { $pkg = static::getPackageObject($bt['package']); if (is_object($pkg)) { BlockType::installBlockTypeFromPackage((string) $bt['handle'], $pkg); } else { BlockType::installBlockType((string) $bt['handle']); } } } } }
public function execute(Batch $batch) { $types = $batch->getObjectCollection('block_type'); if (!$types) { return; } foreach ($types->getTypes() as $type) { if (!$type->getPublisherValidator()->skipItem()) { $pkg = null; if ($type->getPackage()) { $pkg = \Package::getByHandle($type->getPackage()); } if (is_object($pkg)) { BlockType::installBlockTypeFromPackage($type->getHandle(), $pkg); } else { BlockType::installBlockType($type->getHandle()); } } } }