public function create($title = 'Untitled', $preset = 'default') { $installer = new TemplateInstaller($this->container['theme.name']); $title = $installer->getStyleName($title ? "%s - {$title}" : '%s - Untitled'); $style = $installer->addStyle($title, ['preset' => $preset ?: 'default']); $error = $style->getError(); if ($error) { throw new \RuntimeException($error, 400); } }
public function display($id) { if (class_exists('\\Gantry\\Joomla\\TemplateInstaller')) { $installer = new TemplateInstaller(); $installer->loadExtension($this->container['theme.name']); $installer->installMenus(); $installer->cleanup(); } return new JsonResponse(['html' => 'Menus have been installed!', 'title' => 'Installed']); }
public static function copy($style, $old, $new) { $gantry = Gantry::instance(); /** @var UniformResourceLocator $locator */ $locator = $gantry['locator']; $oldPath = $locator->findResource('gantry-config://' . $old, true, true); $newPath = $locator->findResource('gantry-config://' . $new, true, true); if (file_exists($oldPath)) { Folder::copy($oldPath, $newPath); } $installer = new TemplateInstaller($style->extension_id); $installer->updateStyle($new, ['configuration' => $new]); }