Get name of "parent" block, the "children" block is used in


i have multiple blocks where i use a specia limageblock.
I now want to remove a class, if the imageblock is included in a specific parent block.

My usecase:
I have an “above the fold” block where i want to remove the lazyload class.

$block->parent() displays me the page the block is used in…

Any idea?


What would be the parent block if not the page? Do you use nested blocks? Could you post the relevant part of your blueprint, please?

Yes, nested blocks seems to be the better wording.


name: Content - Big Image - above the fold
  snippet: blocks/grid
  css: /assets/css/index.css
    type: blocks
    columns: 1
    max: 1
      image_global: fieldsets/subfieldsets/image_global
      image_page: fieldsets/subfieldsets/image_page

the php:

<figure class="content__image_big ">
    <?php foreach ($data->toloadimg()->toBlocks() as $objectFromData) : ?>
        <?php snippet('blocks/subblocks/' . $objectFromData->_key(), ['data' => $objectFromData]) ?>
    <?php endforeach ?>

Inside the image_page.php I now want to checks if the “parent block” “Content__image_big”

Anyone an idea?

Maybe pass the name of the parent block down to the child block snippet.