Creating Support For Multiple Panels of Grouped Presets In Design Theme Customizer

Permalink
I'd like to develop core code to add functionality to the "Customize Theme" panel. Specifically, I'd like to add one directory level between the presets folder and the defaults.less file in the css folder for custom themes.

What I'm trying to accomplish is multiple panels for grouped presets (see attached mockup). For example, the path would be changed from presets\defaults.less to presets\button\defaults.less, and this would result in a div .list-group called "Button Preset".

The folder for the Preset panel that currently exists in 5.7 would become presets\global,
<?=t("Global Preset")?>)
Should the functionality and code be accepted by Concrete5, Current 5.7 themes in the marketplace could easily be updated by creating a "global" folder and placing their preset .php files in it.

Selecting a preset in the Button Preset group would only override the Global Preset regarding button class (.btn or whatever). It would not override other settings in the Global Preset.

This would make it easy to change all the parameters that govern button styles (e.g. .background-color, .border, .border-radius, .cursor, etc.) using presets that already work together stylistically, in harmony with LESS variables for things like primary-color, which could be changed separately in the styles set.

Code should allow for multiple folders of any name (adhering to naming conventions, of course) to be added, not just button. Any style where it makes sense to group attributes together can be categorized and addressed with this level of directories. In this way, it would be possible to combine multiple groups of presets simultaneously and just tweak a few style settings to easily get great looking style combinations.

I am still figuring out how icons and the selected presets in relation to Global Preset would work, but these seem like minor details right now.

I love the whole concept of the "Customize Theme" panel. I think the developers did a great job, and I'd love to contribute my part with this enhancement.

I have years of experience writing code by myself, but am pretty fresh to working with a CMS, C5, PHP, GitHub and command line. I love the collaboration and community of the open stack, which is why I'm "grinning and bearing" the learning curve, transitioning over from closed-stack dev.

I'm having a hard time pinning down all the separate files and functions I'd have to edit in order to support preset groups. I'm used to dealing with 1k lines of code, not tens of thousands... so it's a bit daunting right now.

So far, I've isolated the following files:

Defines class Preset:
…\concrete\src\StyleCustomizer\Preset.php

Defines class Preset:
…\concrete\src\Area\Layout\Preset.php
It is defined again, this time as an extension of Object. Why is it defined twice with different methods?

Defines class Presets as an extension of BackendInterfaceController:
…\concrete\controllers\dialog\area\layout\presets.php

Defines the variable $presets in the Customize class public function view():
…\concrete\controllers\panel\page\design\customize.php

Generates the html for the customize theme design panel:
…\concrete\views\panels\page\design\customize.php

Once I add the level of directories to the "presets" folder, I would modify code in the latter customize.php file to loop through these directories and create a separate panel for each one.

I.e.:

<div class="list-group" data-panel-menu-id="page-design-presets"  data-panel-menu="collapsible-list-group">


would not be "hard-coded", but would be the result of a foreach loop.

I'm still at a loss how the value for $presets in customize.php has been defined:

<?php if (count($presets) > 0) { ?>


$presets is defined differently in different .php files, so how does the customize.php file know which definition to use in order to do the count? Is there a "master" file that contains just php variables?

Is there an easier way to find where functions and variables that I come across are defined, other than browsing through the file structure (which is quite time-consuming)?

Finally, I'm not sure if I'm accessing the db correctly, or at what point data gets written to the db when folders are added. For example, if I create a presets file and populate it, at what point does that data get written to the db? I've tried accessing via phpMyAdmin, but I can't seem to find values that should be there.

Any answers, tips or suggestions on how to approach this would be very welcome and appreciated!

Thanks a mil!

1 Attachment

 
robodev replied on at Permalink Reply
Just another forum user here.

I don't know how this process works, but perhaps this link may help:

http://www.concrete5.org/developers/submitting-code/submitting_code...
burtondev replied on at Permalink Reply
Thanks robodev! I came across this page in my research, but since it's for bugs and technically what I'm proposing is an enhancement, I didn't think it was the right place to post.

But I guess I could post in the bug tracker and then if there's another tracker for enhancements, the moderator could move it to the right place.