Custom node types vs. layout property


(Lorenz Ulrich) #1

Imagine a normal Text or Text with Image element, but you want to allow the editor to change its look. Some examples:

  • Different font size to emphasize text
  • Different background color to draw attention

In TYPO3 CMS, I would use the property “layout” or “section_frame” for this task which allows wrapping the content with different markup.

In Neos, I have to simple possibilities:

  • Create a separate Node type for each style. This is very easy, but could also clutter the “New Node” dialog.
  • Create a layout property for certain nodes and change wrap according to the layout.

How do you normally implement such a requirement? Are there any cons speaking against using a layout property?


(Berit Hlubek) #2

I personally would say:

  • If it’s only about adding a class to some container for individual styling or something similar I’d add new properties to the corresponding nodetypes.
  • If it’s also about major adjustments, e.g. add new fields like a second image within text with image or a download link or whatever you could think about I would create a new nodetype.
  • Last idea: If it’s about putting a background around stuff, something like a box, it could also be a good idea to create a new nodetype and call it box and for example give it a property to select the color or the like. This would have the advantage that you can use it as container element and put whatever content inside that you want or allow certain node types the editor is allowed to put inside etc.

(Sebastian Kurfuerst) #3

Hey Lorenz,

for me, the main distinction is whether it’s just about a different layout, or whether it has a different structure (i.e. more fields etc). So same as with Berit :smile:

Does that help you?

All the best,
Sebastian


(Rens Admiraal) #4

A bit off topic, but in our current project we had a similar discussion, and we added a little extra rule besides the things mentioned above:

Try to prevent adding options to the interface as much as possible, so if the styling in any way can be derived from a parent nodetype / location of the element, then do that instead of adding the options.

It’s all about limiting “Editor freedom” to actually match the “Styleguide” for your website :wink: