hasEditTemplate + pimcore_areablock

I am trying to create a configurable Grid-Brick into which I then want to be able to drop further bricks depending on the configuration. E.g. make it have one or two columns or making it a wide or a narrow row.

My current state of the grid\view.html.twig is the following:

<section class="section">
    <div class="container">
        <div class="row">
            <div class="col lg:w-7/12">
                {{ pimcore_areablock(
                    'structure-content1',
                    {
                        "allowed": ["headline", "paragraph"],
                    }
                )}}
            </div>
            <div class="col lg:w-5/12">
                {{ pimcore_areablock(
                    'structure-content2',
                    {
                        "allowed": ["headline", "paragraph"],
                    }
                )}}
            </div>
        </div>
    </div>
</section>

This allows me to neatly drag and drop any Headline or Paragraph Bricks into the specified Areablocks. Now, as soon as I add

public function hasEditTemplate()
{
    return true;
}

to my Grid.php I can access the options within my grid\edit.html.view, however, my Areablock placeholders just disappear from the editor. How do I use both features at the same time? Thanks in advance!

Enable forceEditInView option in your areablock
https://pimcore.com/docs/5.x/Development_Documentation/Documents/Editables/Areablock/index.html#page_Brick-specific-Configuration

1 Like

Thanks for the response! Actually, I tried forceEditInView before posting but couldn’t figure out how to actually usw it. Thanks to your answer I had another look at it and realised I had to configure it at the parent Areablock level. Meaning, in my example I have a base template called layout.html.twig in which I had to do the following:

   ...
    <main class="main">
        {{ pimcore_areablock(
            'layout-area-block',
            {
                "allowed": ["grid"],
                "params": {
                    "grid": {
                        "forceEditInView": true,
                        "editWidth": "800px",
                        "editHeight": "500px"
                }
            }
            }
        )}}
    ...

Hope this helps whoever is trying to figure this out for themselves! Cheers