Icons Registry Module
adnan - 7 months ago
Sharing my experience building a module, icons-module, that can be used to manage icon definitions from the Control Panel. I'm developing this as part of a client project I am currently working on, but if anyone is interested I can open source it,
There was quite a bit of learning I had to do to achieve the end-result with minimum code by avoiding overriding/extending views and classes unnecessarily,
The module uses a stream to store entries of the Icons Registry. This stream gets seeded when the module is installed. I had to get access to the default Stream Platform Icons Registry list of icons which was a protected property, .. so I had to do this.
Each icon in the Grid view is selectable so that an action,
delete etc, can be triggered. This and the animations were achieved by styling the checkbox element,
The other challenging tasks I had to overcome were, to inject assets and select different partial views dynamically, based on the current Table view. I did that by extending the functionality of the TableBuilder so that it considers Table view
options (options to change
limit of entries).
The Grid view uses two different partial views (
body), but instead of overriding the table.twig just so that I can change the partials, I decided to dynamically override the view from the module service provider by overriding the
I am sure I've done some of this right, and some wrong, but the good news it works. Please feel free to correct or advice on any of the methods I used to achieve the final result,
Happy coding :)