public function import(\SimpleXMLElement $sx) { if (isset($sx->systemcontenteditorsnippets)) { foreach ($sx->systemcontenteditorsnippets->snippet as $th) { $pkg = static::getPackageObject($th['package']); $scs = Snippet::add($th['handle'], $th['name'], $pkg); if ($th['activated'] == '1') { $scs->activate(); } } } }
public function execute(Batch $batch) { $snippets = $batch->getObjectCollection('content_editor_snippet'); if (!$snippets) { return; } foreach ($snippets->getSnippets() as $snippet) { if (!$snippet->getPublisherValidator()->skipItem()) { $pkg = null; if ($snippet->getPackage()) { $pkg = \Package::getByHandle($snippet->getPackage()); } $t = Snippet::add($snippet->getHandle(), $snippet->getNAme(), $pkg); if ($snippet->getIsActivated()) { $t->activate(); } } } }