Support

Account

Home Forums Feature Requests Making a image selection field with Conditional Logic Reply To: Making a image selection field with Conditional Logic

  • If you want this built into the current field then I’d suggest contacting the developer. https://www.advancedcustomfields.com/contact/. The more requests the developer gets the more likely he is to think about adding a feature.

    I am a developer, when I need something like this I generally work with what’s already in ACF and use filters and add customization for specific fields.

    You can already do basically what you are asking by specifying images for labels and then just add some customization using css/js

    
    red : <img src="url-of-red.jpg">
    yellow : <img src="url-of-yellow.jpg">
    

    It may be possible to .extend the other fields to modify the conditional logic. I think I’ve tried this in the past. I don’t remember who it turned out and I can’t find it in my archives.

    If I needed to do this a lot I might consider adding a custom field setting to the existing field type https://www.advancedcustomfields.com/resources/adding-custom-settings-fields/ and then use an acf/render_field filter to modify the choices displayed and then add custom CSS and JS as needed by using a specific class for the field wrapper. I might even go as far as making my new field setting dynamic based on the values entered into the ACF choices field using custom JS. Nearly any field type built in to ACF can be used as a field setting in any other field type. As an example if you take a look at my medium editor plugin, this field type that I build uses a repeater field as one of its field settings. It is even possible to use an image field as a field setting https://support.advancedcustomfields.com/forums/topic/default-value-for-images/. Taking it a little further you could have a radio field as a field setting that toggles between standard input and image input and then dynamically populate the built in ACF choice field base on whatever is entered into the custom field settings for images.

    Sorry, I may have gone off in many directions, just trying to help give you options on how to get to where you want to go without building a new field that would require hacking the ACF files.