# Arrayfields in panel?

**URL:** <https://forum.getkirby.com/t/arrayfields-in-panel/27824>\
**Category:** Questions\
**Tags:** v3\
**Created:** [February 11, 2023, 6:15am UTC](https://forum.getkirby.com/t/arrayfields-in-panel/27824 "2023-02-11T06:15:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rapsli](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/rapsli/32/12891_2.png) [@rapsli](https://forum.getkirby.com/u/rapsli)\
**Post date:** [February 11, 2023, 6:15am UTC](https://forum.getkirby.com/t/arrayfields-in-panel/27824/1 "2023-02-11T06:15:52Z")

</div>

Is it possible to have some kind of “array fields”? The idea behind is the following. Lets say you have a more complex ul list that you want to build, with icons for example. So I would like to offer a way for a user to dynamically adding more fields.

For example, a section called “services”. There is a list with services and every service has an image. It should be possible to add and remove services. One way would be to build a subfolder structure, but this seems bloated?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 11, 2023, 9:08am UTC](https://forum.getkirby.com/t/arrayfields-in-panel/27824/2 "2023-02-11T09:08:56Z")

</div>

The structure field is perfect for that: [Structure | Kirby CMS](https://getkirby.com/docs/reference/panel/fields/structure)

For nesting, you could use an object field ([Object | Kirby CMS](https://getkirby.com/docs/reference/panel/fields/object)) inside the structure, or nest another structure.

---

<div class="post-metadata">

**Author:** ![rapsli](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/rapsli/32/12891_2.png) [@rapsli](https://forum.getkirby.com/u/rapsli)\
**Post date:** [February 16, 2023, 8:45am UTC](https://forum.getkirby.com/t/arrayfields-in-panel/27824/3 "2023-02-16T08:45:08Z")

</div>

a simple follow-up question on this

```auto
title: Homepage

columns:
    main:
        width: 2/3
        sections:
            section_main:
                type: fields
                fields:
                    doors:
                        label: Türen
                        type: structure
                        min: 1
                        max: 3
                        fields:
                            bild:
                                type: files
                            link:
                                type: url

```

and in my template I got:

```auto
<?php foreach($page->doors()->toStructure() as $item): ?>
                        <?= $item->link() ?>    
                    <?php endforeach ?>

```

But somehow I don’t manage to access the fields link and bild. It’s probably just a tiny thing, but would be great if you can shed light in the darkness 🙂

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [February 16, 2023, 9:05am UTC](https://forum.getkirby.com/t/arrayfields-in-panel/27824/4 "2023-02-16T09:05:59Z")

</div>

For the link, the code is fine and should work. For bild, you’d have to call

```auto
<?php foreach($page->doors()->toStructure() as $item): ?>
<?= $item->link() ?>  
<?php if ($img = $item->bild()->toFile()): ?>
<?= $img ?>
<?php endif ?>  
<?php endforeach ?>

```

Or use an image tag and then output the image url.  
If there can be multiple image in `bild`, then use `toFiles()` and a loop.

---

<div class="post-metadata">

**Author:** ![rapsli](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/rapsli/32/12891_2.png) [@rapsli](https://forum.getkirby.com/u/rapsli)\
**Post date:** [February 16, 2023, 9:11am UTC](https://forum.getkirby.com/t/arrayfields-in-panel/27824/5 "2023-02-16T09:11:59Z")

</div>

I don’t know what I was doing… but now it works.
