#Detect a specific block in a Block List with multiple sections/areas

1 messages · Page 1 of 1 (latest)

sullen hornet
#

In a setup looking like this, how would you detect the GalleryBlock ?
I need to know if the page contains a GalleryBlock.

The property alias of the Block List is pageContent and the block we're looking for is called galleryBlock
The first section is called sectionLayout and only has 1 area contentArea, and the splitter is called horizontalSplitLayout and has 2 areas: areaOne and areaTwo

All I need is a true / false whether the galleryBlock is present or not.

I've tried several things, but there is something I'm missing 🙂

forest geyser
#

hi, you could do something like

if (block is BlocklistItem<GalleryBlock>){
do something with it
}```
or something of that nature
#

or something sleaker (just typing in the chat, check the syntax)

#

maybe need to enter wherenotNull() in between

split badge
#

.Any(block => block is BlocklistItem<GalleryBlock>) I would done it like this to avoid double iteration through 😉