I was just wondering if it’s possible (or if there is a specific way) to add theme specific settings to the ContentBox Admin.
For example I have a theme and want the user (content editor, admin etc) to be able to select the theme colour in the admin under System > Settings > Theme
So in the theme’s .cfc maybe there could be a this.settings structure which the admin would then interpret and display as a form like the other configuration options.
I understand these settings could be added manually via the Geek Settings but it would be nice if the could be automated depending on the theme and exposed within the site settings so users don’t have to go to the Geek settings.
Richard this is a great idea and something i do want to add as well. In the next release 1.1 we alteady have lifecycle events for layouts for activation and deactivation.
I have approached this in another manner, the concept is either the settings are stored in its own table for the theme, module or whatever and when it is loaded it checks to see if that exists if not it creates the default settings.
However there is a known issue with ContenBox at the moment, that when you delete themes and modules, the settings will never get deleted, until modules for ContentBox support an onDelete interception point.
But the concept is simple, and I am more than happy to show you what I am currently working on. In fact I might even blog this one.
My initial idea was to leverage the existing settings service and maybe prepend the layout name to the settings in order to identify the settings that relate to that theme.
I see from the current build as Luis mentioned the onActivation() and onDeactivation() methods are called if they exist. So I assume custom settings and their defaults could easily be stored in the db via the settingsService within these methods by injecting settingService@cb into the themes cfc. Maybe automatically prepending the setting name with “theme_” so the settings can be identified by System > Settings > Theme to generate a form for easy editing.
Not sure if this would be the best route to take as I’m still learning how ColdBox works, but it’s good stuff No been this excited about coding in a long while.
seems the most natural place to put them. Maybe with a direct link from the layouts page. The this.settings structure would be ideal.
On side note to this just a little suggestion. Can the menu name “Look & Feel - Layouts” be changed to “Look & Feel - Themes”. It’s a bit confusing as Themes can have multiple layouts and the page title is “Layout Themes”
Ok guys I got inspired in the plane and have it working now. Will commit soon.
You will be able to declare settings in the layout cfc and ContentBox will register them and manage them for you. If the layout is deleted the settings are deleted as well.
The ui for the layouts has completely changed. I added a better tab navigator so you can manage the active layout and the other layouts.
The active layout now shows its information and the settings form.