示例#1
0
 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);
     }
 }
示例#2
0
 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']);
 }
示例#3
0
 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]);
 }