Last active
May 29, 2019 15:14
-
-
Save scsskid/e937c949f2ee46aeda39dc431595e0f4 to your computer and use it in GitHub Desktop.
Kirby Nested Structure Field Loop & output of single nested instance examples (Content Structure inspired by Kirby Page Builder)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Builder: | |
- | |
text: | | |
Die zunehmende Urbanisierung stellt Städte vor eine Vielzahl von Herausforderungen – auch mit Blick auf die Mobilität: Mit der Einwohnerzahl wachsen auch die Verkehrsprobleme innerhalb von Ballungszentren. Der Verkehrssektor trägt über ein Viertel zum weltweiten Ausstoß klimaschädlicher Emissionen bei und wirkt sich negativ auf Umwelt und Gesundheit aus. Gleichzeitig stellt Mobilität ein Grundbedürfnis der Stadtbewohnerinnen und -bewohner dar und ist damit eine wichtige Voraussetzung für Wirtschaftswachstum, persönliches Wohlbefinden, Kreativität und soziale Integration. Um Städte wieder zu lebenswerten, sauberen und gesunden Orten zu machen, sind intelligente Lösungen gefragt. | |
(image: magazin-mobilitaet-1.svg) | |
_key: text | |
_uid: text_0 | |
- | |
elements: | |
- | |
title: Erster Eintrag | |
bla: 1 | |
_key: usps_el | |
_uid: usps_el_0 | |
- | |
title: Zweiter Eintrag | |
bla: 2 | |
_key: usps_el | |
_uid: usps_el_1 | |
- | |
title: Dritter Eintrag | |
bla: 3 | |
_key: usps_el | |
_uid: usps_el_2 | |
_key: elements | |
_uid: elements_0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$blocks = $page->Builder()->toStructure(); | |
// dump( $blocks ); | |
foreach($blocks as $block) { | |
$nestedBlocks = $block->elements()->toStructure(); | |
foreach($nestedBlocks as $nestedBlock) { | |
dump($nestedBlock->_uid()); | |
} | |
} | |
//dump($blocks->findBy('_uid', 'elements_0')); | |
echo "<hr><hr>"; | |
foreach ($blocks->findBy('_uid', 'elements_0')->elements()->toStructure() as $el) { | |
dump($el->_uid()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment