Jump to content

Get repeater field subfield value by other subfield value


hellomoto
 Share

Recommended Posts

I tried

$homepage->get('misc_site_meta')->where('title=year')->first()

but first() isn't applicable and without it nothing. Trying to get value of subfield value_text; tried ->value_text in place of but that didn't work either.

It's

$homepage->misc_site_meta->first('title=year')->value_text

 

Link to comment
Share on other sites

What type of field is misc_site_meta??

Most get methods will return a "non iterable" object so first() is unlikely to work.

Ok it's a repeater, you specifically say so in the title lol my pardon!

Try:

$homepage->misc_site_meta->get('title=year');

This will get you the first repeater item in the misc_site_meta field where title field equals "year".

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...