Hey.
I want to shorten the first text block in my layout, to use it as a teaser on the parent page.
I read this one, and it seems, that I am on a good way, but …
https://forum.getkirby.com/t/pull-first-text-field-from-a-blocks-loop/25008
it looks like that, I am missing some steps on the way.
<?php foreach($page->children()->listed() as $subpage):?>
<?php
$teaser = $subpage->layout()->toLayout()->filterBy('type', 'block_text')->first();?>
<div class="teaser_element">
<h3><?= $subpage->title()?></h3>
<?php $TextCount = array_slice( explode(" ", $teaser->text()->kt()), 0, 20);
$TextShort = implode(" ", $TextCount) ?>
<div id="ellips_container_short<?= $subpage->id()?>" class="brot_standard_steady text-container">
<span> <?= $TextShort ?>...</span>
</div>
</div>
<?php endforeach; ?>
The output is:
[{“attrs”:,“columns”:[{“blocks”:[{“content”:{“size”:“gro\u00df”,“text”:"My text the alignment along the main axis. It helps distribute extra free space leftover when either all the flex…
So it looks like i am stuck in the layout and can not go deeper.
$teaser->columns()->blocks()->content()->text()
This has the exact same output…
You have any clue?