Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

Adding blocks to dynamic object choices

edited April 2013 in Framework

I was surprised to see that I couldn't add a block to a page from the dynamic objects menu. I think I will add it as an option, unless there's a reason why it's not a good idea.

Comments

  • Hmm, never thought of adding blocks to the dynamic objects, mainly because I've always setup my blocks in my layouts...

    I'm curious about the use case for embedding blocks within the body of a page, blog post, etc. I guess you could even embed a block within other blocks! Haha

  • edited April 2013

    LOL. Recursive blocks.

    This particular case is a home page blurb. I was thinking it would be easier for the client to update a block than the whole page.

  • Ah yes I see. Makes sense to limit what they need to edit for a particular change. No sense editing the whole page and potentially messing something else up if you can just edit a block within it.

  • Right. Also, if there were a dynamic object interface, they could easily switch among several pre-defined blocks.

  • If you need a predefined dynamic object, wouldn't you just use the dynamic objects menu for that?

    Would also be good to find a way to ensure a block can't be embedded within itself, even multiple levels deep, creating an infinite loop in the rendering.

  • Yes, I want to use the dynamic objects menu to choose the block, so that the user can, from the home page wysiwyg editor, click on the dynamic block object and choose a different block. (I'm not sure if I'm making myself clear. Would screenshots help?)

  • Let me see if I'm getting it.

    What if you setup the home page with 3 embedded blocks (via the Dynamic Objects menu), one for each column on the default Elefant homepage.

    If they want to edit the contents of one of those blocks, they could then do so by clicking the edit button for just that block.

    If they wanted to update the block itself, they could edit the page, then click on that block's embed marker to pull up the Dynamic Objects dialog again. This would open the dialog to the 'Embed a Block' option, which would let them modify the properties of that block, similar to the click-to-update for any other dynamic object.

    Am I close? :)

  • Yup. :)

    Only tweak is that I'm thinking there might be, say, 10 blocks already created and they could use the dynamic menu to select any of them.

  • It may need a custom field type added to the dynamic objects menu that would allow the user to choose an existing but also enter a custom ID for new blocks. Something like these:

    http://www.fairwaytech.com/flexbox/flexbox-demos/#demo8 http://jonathan.tang.name/files/jquery_combobox/demo.html

    I was planning on adding a helper for something like this, and short-listed a couple libraries on Github, but they don't seem to allow custom text input except in a "tagging" mode, which isn't quite what we would want.

  • Why would they need to be able to enter a custom id?

  • When you're setting up a block in a template, you don't need to create the block first. It can even have a dynamic value like banner-[id] which takes the page ID to build a custom block ID lookup. Combine that will fallbacks and blocks can be pretty versatile:

    {! blocks/index?id=banner-[id]&fallback=banner !}
    

    But maybe that's not needed in the Dynamic Objects menu. Keeping it simple there may be better for end users, and just exposing the full features to layout designers.

  • I got to tell you that the blocks feature is great. I honestly thought at it was just a competitor to widgets on WordPress but they are much more powerful than that. They make design so much more rapid.

  • I believe it was @betaman who really made the blocks as flexible as they are now. It's been pretty handy for me too :)

  • Glad you like it :-)

Sign In or Register to comment.