Context

When blocks are used inside a loop (for example, a Query block), the block is executed once for each iteration of the loop. Blockstudio provides handy shortcuts for accessing the current loop and outer context.

index.php

            <div>
      <h1>
        This is the data of current
        element inside the loop:
        <?php echo $block['context']['postId'] ?>
        <?php echo $block['context']['postType'] ?>
      </h1>
      <h1>
        This is the data the current post:
        <?php echo $block['postId'] ?>
        <?php echo $block['postType'] ?>
      </h1>
    </div>
Copy
index.twig

            <div>
      <h1>
        This is the data of current
        element inside the loop:
        {{ block.context.postId }}
        {{ block.context.postType }}
      </h1>
      <h1>
        This is the data the current post:
        {{ block.postId }}
        {{ block.postType }}
      </h1>
    </div>
Copy