Comments (17)
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.
Thanks @circuuz - great point, consistency is nice!
from acf.
Tagging in @AdvancedCustomFields/testers š
from acf.
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.
How different would it be from the 'select2_args' filter ?
It already allows us to connect to custom data-sources.
from acf.
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.
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.
Filter name : acf_{type_of_field}_choice_ajax_args
acf_select_choice_ajax_args
acf_post_object_choice_ajax_args
from acf.
I will prefer 1. Select2 friendly.
from acf.
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.
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.
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.
from acf.
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.
Hi @zackkrida
Very relevant! Yes, this filter would allow you to create select fields that 'talk' to each other š
from acf.
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.
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)
- When returning false in acf/load_field or acf/prepare_field multiple warnings occur HOT 1
- ACF post preview and revisions completely broken HOT 8
- WYSIWYG 'visual' tab in sidebar breaks when switching sidebar tabs HOT 1
- WYSIWYG Editor Field: Image element with width and height attributes triggers unsafe HTML error message HOT 4
- filter wysiwyg_tinymce_settings breaking HOT 1
- Front-end form submits itself when closing the wordpress link-edit dialogue
- Nested cloned repeater only works for 1 level
- Gallery - edit image breaks field in block sidebar HOT 1
- ACF 6.3.0 update breaks "No fields assigned" filter with empty string HOT 3
- Can't add ACF licence key HOT 1
- update_field() not working as expected in this scenario HOT 3
- Installing through composer installs incorrect version HOT 5
- Uncaught TypeError: Cannot access offset of type string on string - flexible content HOT 4
- Fix jQuery deprecations HOT 1
- User field stopped showing in GraphQL query
- Group: image subfield nĀ°10 not working HOT 1
- PLEASE ADD A DISCLAIMER THAT SHORTCODES HAVE TO BE ENABLED NOW HOT 1
- Repeater field type with pagination HOT 1
- Conditional logic in the Advanced Field Settings broke when a wrapper was added v6.2.9.
- Ampersands in Text Area fields produce warnings HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from acf.