Jump to content

Custom fields support for file and image fields: misinformation?


Recommended Posts

Posted

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
Posted
2 minutes ago, Mike-it said:

Thanks @3fingers
I have read the blog post, but i also thought it was a text omission (the option field),
because of the example image, which i doubt is a photomontage ?

Here is more information on the topic:

 

Posted

 @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 ?

Posted
1 hour ago, Mike-it said:

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

Not sure @Mike-it - it's working here like this:

image.png.688007e56169c0eb7f32020971df30f7.png

What exactly are you seeing when you say it doesn't work?

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

Sorry solved...

I'm little embarrassed, we have set the field option_type as single page ? not as a Multiple Pages PageArray now it works...

  • Like 1
  • 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
  • Recently Browsing   0 members

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