How to Package up themes?
Permalink
I have the code below in my Package Controller:
But when I try to install my package it returns a MySQL error:
What could be wrong in the above code?
I've also looked athttp://www.concrete5.org/documentation/how-tos/designers/packaging-... and my code should work based on it.
public function install() { $pkg = parent::install(); $this->configure($pkg); } public function configure($pkg = null) { // install theme $this->installTheme($pkg); // more installations here.. } private function installTheme($pkg = null) { foreach($this->themes as $theme) { $themeHandle = PageTheme::getByHandle($theme); if (!$themeHandle){ PageTheme::add($themeHandle, $pkg); }
Viewing 15 lines of 17 lines. View entire code block.
But when I try to install my package it returns a MySQL error:
mysql error: [1048: Column 'ptHandle' cannot be null] in EXECUTE("insert into PageThemes (ptHandle, ptName, ptDescription, pkgID) values (NULL, '(No Name)', '(No Description)', '18')")
What could be wrong in the above code?
I've also looked athttp://www.concrete5.org/documentation/how-tos/designers/packaging-... and my code should work based on it.
you're mistake is that $themeHandle isn't a handle, its an object. so you check if it exists, all good, but when you install you want it to be PageTheme::add($theme,$pkg);
so that you load the handle. make sense?