I was using Cockpit several years ago, even provided and maintained an HR language file, and I remember using the Regions as snippets, for example, the site navigation menu.
Returning back to see what’s new, I discovered the Singletons introduction as the replacement for Regions but I cannot figure out how to use Singletons for the same example, the site navigation menu.
Thank you @serjoscha87 for your time and effort here. I’m not newbie but not the professional either so bare with me please.
Well, as I wrote in my post, I remember using “old” Regions as snippets (like nav bar or footer). The name and code was all you need to create one.
The Singleton and “new” Region are the form builders. The “new” Region gives me Template where I can create my Snippets (although I don’t get why I need form to get it populated) and the Singleton is basically the same but without the Template.
Could you be so kind and give me few examples of intended use for both Singleton and “new” Region.
I’m afraid I am not able to give you some examples - I usually don’t use singletons and same with the regions back in the days. But I guess you are right - the main differnce is just that the template thingy fell away.
Guess thats all.
So basically now I think a collection is just a bunch of singletons.
@WebShapedBiz, think you can use singletons as basic structures of information that are not repeating, for example, let’s imagine you want to be able to configure the footer of your website, maybe you can have a singleton with a bunch of fields:
Footer Links
Copyright Message
Now let’s imagine you want to store your site generic settings, you can have a singleton “settings” and store things like:
Site Name
Default homepage
Site Logan
Site Logo
Global Metatags
etc…
The difference to regions is already clarified by @serjoscha87, the addon now is irrelevant and its there only for legacy purposes.
Thank you @pauloamgomes@serjoscha87 for your support. I managed to wrap my head around it. The form part was confusing for me, it seemed like an unnecessary overhead to the whole “snippet” concept but I can live with it.
I’m starting to get the concept as well. But for a bit more concrete advice:
When I update my Cockpit instance from 0.7.0 to the latest version and already have a bunch of content in the database … uhm … can I convert regions to singletons?
Region Template was used to return HTML but also run PHP. The PHP could use GET params passed in and so dynamically build the HTML and return it.
Regions basically provided me with a microservice architecture