Forums / Developer / Can self-embedding in editor be done?

Can self-embedding in editor be done?

Author Message

zurgutt -

Wednesday 09 December 2009 5:42:26 am

I want user to be able to edit a folders body and use Embed object with same folder and "Horizontally listed sub items" class to display lists of its children. The reason for this is more possibilities for styling that when hardcoding in template.

There is not danger template recursion if full view is not picked for embedded object.

Editor does not permit self-embedding tho. I am wondering if something breaks bad if i just remove that check from kernel?

Certified eZ developer looking for projects.
zurgutt at gg.ee

Mark Simon

Wednesday 09 December 2009 7:05:25 am

I'm not sure what You mean with

I want user to be able to edit a folders body and use Embed object with same folder ...

If You want to embed objects into the body of a folder, that have this folder as parent, there will not be recursion.
If You want to embed silblings and/or the folder this can cause recursions. I suggest to make an own template to show embedded objects. Include that template in the view of the folder. And use a counter couning every time this template is being included, to set a maximum account to the recursion.

Remember to initialise the counter on the outside (in the folder -view)
and increment it on the inside (the own template)

if your counter comes to a maximum, stop the complete functionality of the template.

Making changes to the kernel is pretty seldom a good idea. especially the recursion lock is something i wouldn't touch.

www.all2e.com

Peter Keung

Wednesday 09 December 2009 11:31:00 am

Workarounds:

  • Create a custom tag specifically for so-called "self-embedding" with an attribute representing the styles you want to support. The custom tag's template can then call an embed template as needed.
  • Embed the folder into another object and then embed that object back into the folder. Sounds silly but has worked rather intuitively for users in the case of building things like side menus.

http://www.mugo.ca
Mugo Web, eZ Partner in Vancouver, Canada

zurgutt -

Thursday 10 December 2009 3:34:15 am

"

Workarounds:

  • Create a custom tag specifically for so-called "self-embedding" with an attribute representing the styles you want to support. The custom tag's template can then call an embed template as needed.
  • Embed the folder into another object and then embed that object back into the folder. Sounds silly but has worked rather intuitively for users in the case of building things like side menus.
"

Custom tag is the route i took eventually. It works fine but complicates user experience a bit. Thanks for good suggestions, Peter.

Certified eZ developer looking for projects.
zurgutt at gg.ee