Hey,
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?
Best
Marvin
texnixe
2
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.
Content__image_big.yml
name: Content - Big Image - above the fold
preview:
snippet: blocks/grid
css: /assets/css/index.css
fields:
toloadimg:
type: blocks
columns: 1
max: 1
fieldsets:
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 ?>
</figure>
Inside the image_page.php I now want to checks if the “parent block” “Content__image_big”
texnixe
6
Maybe pass the name of the parent block down to the child block snippet.