# Is field structure?

**URL:** <https://forum.getkirby.com/t/is-field-structure/8609>\
**Category:** Questions\
**Tags:** v2\
**Created:** [September 24, 2017, 5:20pm UTC](https://forum.getkirby.com/t/is-field-structure/8609 "2017-09-24T17:20:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![plagasul](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/plagasul/32/4199_2.png) [@plagasul](https://forum.getkirby.com/u/plagasul)\
**Post date:** [September 24, 2017, 5:20pm UTC](https://forum.getkirby.com/t/is-field-structure/8609/1 "2017-09-24T17:20:48Z")

</div>

Given a field, how to know if the field is structure?

Thanks

---

<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:** [September 24, 2017, 5:23pm UTC](https://forum.getkirby.com/t/is-field-structure/8609/2 "2017-09-24T17:23:16Z")

</div>

Don’t you know your field types because you define them in a blueprint?

Apart from that, there are two plugins which let you read blueprints:

- [https://github.com/AugustMiller/kirby-architect](https://github.com/AugustMiller/kirby-architect)
- [https://github.com/jenstornell/kirby-blueprint-reader](https://github.com/jenstornell/kirby-blueprint-reader)

---

<div class="post-metadata">

**Author:** ![plagasul](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/plagasul/32/4199_2.png) [@plagasul](https://forum.getkirby.com/u/plagasul)\
**Post date:** [September 24, 2017, 5:26pm UTC](https://forum.getkirby.com/t/is-field-structure/8609/3 "2017-09-24T17:26:49Z")

</div>

Yes, @texnixe, I know my field types… except if I am looping them and I need to do something different in case the field is structure ( like using toStructure() on it ) for example:

```
<?php foreach( $page->content()->fields() as $f ): ?>
  <?php if( $page->$f()->ISASTRUCTUREFIELD() ): ?>
    // dosomething
```

---

<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:** [September 24, 2017, 5:48pm UTC](https://forum.getkirby.com/t/is-field-structure/8609/4 "2017-09-24T17:48:10Z")

</div>

I’d probably check for field names instead of reading blueprints, maybe even give structure fields a name that contains the word structure and then create a field method that check $f for that substring. But it depends on your use case, number of fields etc. There is no other way to find out the type of field without reading the blueprint.

---

<div class="post-metadata">

**Author:** ![plagasul](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/plagasul/32/4199_2.png) [@plagasul](https://forum.getkirby.com/u/plagasul)\
**Post date:** [September 24, 2017, 5:49pm UTC](https://forum.getkirby.com/t/is-field-structure/8609/5 "2017-09-24T17:49:02Z")

</div>

> [@texnixe](#):
>
> There is no way to find out the type of field without reading the blueprint.

Ok, that answers the question. Thank you.

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 5:32pm UTC](https://forum.getkirby.com/t/is-field-structure/8609/6 "2025-02-06T17:32:04Z")

</div>


