Jump to content
Sign in to follow this  
Markus (Blue Tomato)

Get all custom image fields via API

Recommended Posts

How can I get from an image field all custom image fields dynamically?

E.g. $page->image->alt and $page->image->credits but how can I get this fields like $page->image->getCustomImagesFields or $page->image->getCustomImagesFieldsTemplate (where I can use the $template API methods $template->fields... 

 

Share this post


Link to post
Share on other sites

Ah - after describing the problem I found the solution quick

I'll check if there is a template with "field-" and current image field name.

$customImageFieldTemplate = wire('templates')->get("field-$fieldName");

After this I can iterate over $customImageFieldTemplate->fields

  • Like 1

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...