Applying custom paint layouts to form assets


(Oleg Voronin) #1

I'm assuming this is unavailable by default to foolproof the system:

 

 

Is there a way to circumvent this?


(Nic Hubbard) #2

Yes, you can apply a Paint Layout to a custom form. You are seeing this error when applying it?


(Oleg Voronin) #3

Yes. We're running 4.8.3 and I get this error message whenever I select a form asset, lookup settingsacquire locks and change layout. I've also tried applying a paint layout to a form section (actually that's what the uploaded screenshot shows, but I get the same message for "form_email" as well)


(Nic Hubbard) #4

Yes. We're running 4.8.3 and I get this error message whenever I select a form asset, lookup settingsacquire locks and change layout. I've also tried applying a paint layout to a form section (actually that's what the uploaded screenshot shows, but I get the same message for "form_email" as well)

 

This must be a system specific error happening here. You have always been able to apply a Paint Layout to a custom form that I can remember. I just tested it on a really old 3.26.3 site and it works fine.


(Oleg Voronin) #5

 

This must be a system specific error happening here. You have always been able to apply a Paint Layout to a custom form that I can remember. I just tested it on a really old 3.26.3 site and it works fine.

 

Thanks, will investigate this.


(Greg Sherwood) #6

Does this happen when you try to apply the paint layout to the top level Custom Form page? I might sound stupid, but always best to check that you are not accidentally applying things one level down (to the form_email asset).


(Oleg Voronin) #7

Does this happen when you try to apply the paint layout to the top level Custom Form page? I might sound stupid, but always best to check that you are not accidentally applying things one level down (to the form_email asset).

 

Now I might sound stupid, but I am intentionally applying things one level down! Let me elaborate: there's no issue applying a paint layout to the page itself, now I'm trying to apply a paint layout specifically to the form asset. The manuals seem to indicate that a PL is applicable to any asset because rendering its content and properties would operate at a higher abstraction level than functionality mappings - i.e. any asset can have its id/name/content etc. rendered, even if it's a form element (or at least that was my interpretation).

 

As for the "why" - applying a custom paint layout seemed like a decent way to customize markup when all else failed. Don't judge me.


(Greg Sherwood) #8

Don't worry; not judging.

 

You are right in that the manual says "any asset": http://manuals.matrix.squizsuite.net/paint-layouts/chapters/what-are-paint-layouts

 

This is a documentation error that I will get fixed. Not every asset type can have a paint layout applied, but every top-level page type can. Those are the assets that actually print output to the screen at a given URL (i.e., they can have a URL applied to them) and so you can format their output.

 

CORRECTION: That page says "an asset" and not "any asset". I've asked for the documentation to be changed to clarify what assets can have paint layouts. It already says that you must have a design applied for a paint layout to work, but doesn't explicitly says that not every asset can have a paint layout applied.


(Oleg Voronin) #9

This is a documentation error that I will get fixed.

 

Could we instead leave the docos as is, and instead get the ability to apply paint layouts to everything?  :)  But seriously, off the top of your head, any particular reason for this restriction? Was it not there in 3.26.3 as per Nic's post above?

 

IMO the way squiz manages forms (serialized fields that can have their content and behaviour edited by non-devs) is very hot, but the lack of ability to apply truly custom formatting is a bit unexpected. If added it would be a very welcome feature for some, if paint layouts are unavailable I'll take any alternative means of templating or something lower level like xslt.


(Nic Hubbard) #10

 

But seriously, off the top of your head, any particular reason for this restriction? Was it not there in 3.26.3 as per Nic's post above?

 

I was applying it to the top level page as Greg described. I have never had a reason to do otherwise.


(Greg Sherwood) #11

 

Could we instead leave the docos as is, and instead get the ability to apply paint layouts to everything?  :)  But seriously, off the top of your head, any particular reason for this restriction?

 

Assets under top-level page assets are essentially configuration. They don't have URLs and can't be accessed directly. They can sometimes be used in multiple places to share content and configuration data, but they don't have the required functions to print their own contents to screen and be used as a stand-alone page.

 

Paint layouts and designs act at a level above all this. A URL is requested and this system takes over to determine what design to use. Then what paint layout to use. The paint layout will have keywords to bring in content from the page associated with that URL, but isn't going to dig deeper into the configuration of that page because it doesn't know the specifics of it.

 

For paint layouts to be available on form_email and form_section assets, the custom form page itself would need to be rewritten to actually do something with these paint layouts. Instead, the form provides bodycopies for you to customise the layout in any way you want. If you really want, you don't have to have the form output anything. You can hard-code every bit of the HTML and just make sure you name your fields correctly so the backend code can process the form submission.