Forum

Thread tagged as: Question

Let the author choose from different media types

Hi guys,

I'm trying to solve the following problem: I would like to build a textblock with the option to append one of a number of mediatypes like image, video or iframe (= number of different templates). At the moment I solved this by using a number of blocks: textblock with image, textblock with video, textblock with iframe and so on. Problem: List of blocks in the admin becomes cluttered, templates are redundant

I would like to have one block with the option to choose from different mediatypes (=templates).

Idea 1: author chosses mediatype from selectbox or radiobuttons. admin displays only the needed inputs. Idea 2: nested blocks Both are (to my knowledge) not possible with perch.

Is there a way I haven't thought of to solve the problem?

<perch:blocks>
    <perch:block type="textbox-w-image" label="textbox with image">
        <perch:template path="textbox-w-image.html" />
    </perch:block>
    <perch:block type="textbox-w-video" label="textbox with video">
        <perch:template path="textbox-w-video.html" />
    </perch:block>
    <perch:block type="textbox-w-iframe" label="textbox with iframe">
        <perch:template path="textbox-w-iframe.html" />
    </perch:block>
</perch:blocks>

Thanks for your help!

Jochen R.

Jochen R. 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

No, Blocks is the way we solve this problem in Perch.