Jump to content

Returning a field's type?


a-ok
 Share

Recommended Posts

Why does this return null?

$page->products_sku->type

I thought you could check a field's type? I know this works...

$fields->products_sku->type

But if I have the following, how could I check the type?

$slides = $page->products_sku;
// I need to return $slides type
bd($fields->products_sku->type);

 

Link to comment
Share on other sites

10 minutes ago, lokomotivan said:

$fields->get("priduct_sku")->type

 

Exactly. And just to clarify: $page->field_name returns a value stored in the field, not a field object, so that's why you can't check the type of the field that way ?

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...