Jump to content

Custom fields support for file and image fields: misinformation?


Mike-it
 Share

Recommended Posts

From the blog post you've linked:

Quote

You may use fields of these types: Text, Textarea (non CKEditor), Integer, Float, Page Reference, Checkbox, Toggle, Datetime, Email, URL. You may also use the multi-language versions of core Fieldtypes. For Page Reference fields, you may also use any of the core input types it supports.

Radio input (like the "License" one shown in the image) looks like is not mentioned there, so yes, to me it looks like a misleading example.
I read somewhere in the forum that ryan has the intention to make some polish on custom image field, but honestly I don't remember where.
 

  • Like 1
Link to comment
Share on other sites

 @adrian 

Thanks, i successfully recreated your example, using Page Reference and it works perfect in a multilanguage site
(also used the module you mentioned https://processwire.com/modules/process-page-field-select-creator/)

But suppose to have a multiple selection for "License type" so any image should dsplay all available license assigned

This works with a single selection

echo $image->option_type->title;

Don't understand why it doesn't work with a foreach am i missing something?

foreach($images as $image){
	foreach($image->option_type as $opt){
		echo $opt->title;
	}
}

Any help is appreciated ?

Link to comment
Share on other sites

Just now, Mike-it said:

I got this notice:


*Notice*: Trying to get property 'title' of non-object...

 

Sounds like you need to double check the name of the "option_type" field and check that it is set to support multiple values. Debugging this stuff is much easier with the Tracy Console because you can dump at each step of the process to figure out where the problem actually is.

  • Thanks 1
Link to comment
Share on other sites

  • 2 months later...

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