Giter VIP home page Giter VIP logo

Comments (17)

kevinwhoffman avatar kevinwhoffman commented on July 24, 2024 9

The idea of the filter sounds really helpful. Of the two options, I prefer the first "Select2 friendly" because the results are isolated in their own array. This would make it easier to iterate over as you can safely assume everything within the array is a result and more can still be targeted separately.

from acf.

elliotcondon avatar elliotcondon commented on July 24, 2024 1

Thanks @circuuz - great point, consistency is nice!

from acf.

elliotcondon avatar elliotcondon commented on July 24, 2024

Tagging in @AdvancedCustomFields/testers šŸ‘

from acf.

N-Molham avatar N-Molham commented on July 24, 2024

Well, it would ease up the process and lower the number of operations to reach the same results. I think it worth it. That for the nice idea.

from acf.

mdorchain avatar mdorchain commented on July 24, 2024

How different would it be from the 'select2_args' filter ?
It already allows us to connect to custom data-sources.

from acf.

elliotcondon avatar elliotcondon commented on July 24, 2024

Hi @mdorchain - thanks for the question.

In theory, they can both be used to perform the same result, however, this PHP filter will also allow developers to customize all AJAX responses. For example, when used on the post_object field type, this filter will be run after the results have been found and will allow the developer to perform custom PHP logic.

The second benefit is that you can interact with any data source (irrelevant of the returned format) and use PHP to return it in the correct format šŸ˜€.

from acf.

joiglifberg avatar joiglifberg commented on July 24, 2024

I prefer the "Select2 friendly", but what about error messages? Would this allow us to filter the error message displayed by Select2? This is helpful when an API request would fail for instance.

from acf.

nisargindianic avatar nisargindianic commented on July 24, 2024

Filter name : acf_{type_of_field}_choice_ajax_args
acf_select_choice_ajax_args
acf_post_object_choice_ajax_args

from acf.

nisargindianic avatar nisargindianic commented on July 24, 2024

I will prefer 1. Select2 friendly.

from acf.

mdorchain avatar mdorchain commented on July 24, 2024

I think the php select2 filters is a good idea, eventually having matching targeted js filters will also remain helpful. Often I have to hook on the select2_args js filter to update the datasource on the fly. Right now, it requires identifying properly the fields within the filter because the select2_args is generic to all select2 fields on the page.

from acf.

elliotcondon avatar elliotcondon commented on July 24, 2024

Hi @circuuz

Would this allow us to filter the error message displayed by Select2? This is helpful when an API request would fail for instance.

Good point. We should allow for 'results, more and error' to be returned. A custom error string will be very handy. Maybe if the response is a string, this could also be read as an error message?

from acf.

elliotcondon avatar elliotcondon commented on July 24, 2024

Hi @mdorchain

eventually having matching targeted js filters will also remain helpful

Yes, I'll be sure to add in 'name' and 'key' actions/filters too!

from acf.

joiglifberg avatar joiglifberg commented on July 24, 2024

from acf.

zackkrida avatar zackkrida commented on July 24, 2024

Could this be used to populate a select/taxonomy/etc. based on the value of a sibling field?

For example -- I have a select of all my site's custom post types, then based on that value I'd like to have a sibling select populated with all of the chosen post type's taxonomies.

This seems like a semi-relevant place to bring this up -- apologies if it isn't!

from acf.

elliotcondon avatar elliotcondon commented on July 24, 2024

Hi @zackkrida

Very relevant! Yes, this filter would allow you to create select fields that 'talk' to each other šŸ‘

from acf.

cfxd avatar cfxd commented on July 24, 2024

It seems this might also be able to achieve a long time wishlist item of mine which would allow purely customized lists in Relationship fields (e.g., taxonomies or arbitrary key/value pairs).

In the past I've relied on the multi-select option for the Select field but I find the Relationship field UI much smoother and with a cleaner drag & drop interface that clients prefer.

You've got my vote šŸ‘ŒšŸ»

from acf.

JiveDig avatar JiveDig commented on July 24, 2024

This is way old, but resurrecting this as it would be great to be able to paginate dynamically loaded select fields with a potentially large number of choices.

from acf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.