Is field structure?

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


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:

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

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.

Ok, that answers the question. Thank you.