Quick question re: Layouts

Topics: Core, Customizing Orchard, General
Jun 12, 2015 at 9:02 AM
I note that I can add fields attached to my content item to the Layout editor, is it possible to add such fields into a Content>HTML block or reference them from a HTML block? Why -- I anticipate my Layouts will get quite complicated considering what I have currently - so it would be nice to change the field in the content item editor quickly and have that change reflected in the Layout editor upon save...it also, would be super handy for images in div backgrounds? Anyone know if this is possible? Thanks in advance, Liv
Jun 12, 2015 at 9:45 AM
Absolutely, this is the intended purpose for those part and field elements - to render them inside of the layout, but edit the contents using the regular part and field editors. This has been implemented for TextField, BodyPart, CommonPart and TagsPart. If you need support for any other type of part or field, I would like to suggest you create a new issue for it on GitHub and maybe request that we implement support for all out of box parts and fields (where it makes sense to display something on a layout).

Regarding images in div backgrounds, that would be super handy indeed. Perhaps we need a container element called BackgroundImage? This would be a container similar to the Canvas element, but with the ability to select a background image. What do you think?
Jun 14, 2015 at 10:06 PM
Indeed! I think what i'll do, is transpose my old templates into Layout form and just field test what could be improved as I go -- but couldn't agree more with ^. Thanks for the reply and i'll let you know how I get on ;) Big thanks, Liv
Jun 19, 2015 at 6:17 AM
Hi Sipke - I have a Layout Part attached to a content type which also has several text fields added to it as well - how do I reference those fields from a snippet? [I know I can add textfields to layouts directly, but this is not scalable enough for my needs] - thanks for your time in advance, Liv.

PS> Regarding your last post - I have written many replies with ideas on how I ""think"" Layouts could be improved, only to delete them when I have worked out your intention with Layouts implementation thereafter ;) -- though I do believe "Backgrounds and Links" both need a way to be attached to elements, yet controlled by the Layouts original intended input "fields" - not rely on css; it's just way too common to have templates with text on images [and in my case with slides], many areas of a slide with different links [and/or] the whole canvas/slide being a link. I have a barrage of other suggestions, but If I can acquire the data from my "Fields" attached to this content item and use them in snippets, all of them become obsolete ;) […I'm hoping there is a simple method and that I don’t have to write a driver to try and ascertain the current content item that has the layout attached id etc.]
Jun 21, 2015 at 9:25 AM
Edited Jun 21, 2015 at 9:25 AM
So if I understand correctly, you need to be able to access the current content item from a Snippet element (essentially you need it from the Shape that is configured to be rendered by the Snippet element, correct?). If so, that is currently not possible since we are not setting any properties on the Shape of the Snippet element being rendered, but it would be a nice feature to have, so definitely create an issue for this on GitHub if you want. Thank you for your feature suggestions, it's much appreciated.