$field->toStructure()
Converts a yaml field to a Structure object
$field->toStructure(): Kirby\Cms\StructureReturn type
This method modifies the existing $field object it is applied to and returns it again.
While the yaml method returns a simple associative PHP array for structured field content, the toStructure method gives you a full blown Kirby Collection which makes it possible to use Kirby's chaining syntax.
Examples
Text file
Title: My page
----
Accounts:
  - name: Mastodon
    url: https://mastodon.social/@getkirby
  - name: GitHub
    url: https://github.com/getkirbyTemplate
<h1>On the web</h1>
<ul>
  <?php foreach ($page->accounts()->toStructure() as $account): ?>
  <li>
    <a href="<?= $account->url() ?>">
      <?= $account->name() ?>
    </a>
  </li>
  <?php endforeach ?>
</ul>