Kind of similar to #3888 but not the same. There are really two strings for EDD select dropdowns: the placeholder visible on the field before it is interacted with and the placeholder in the search field.
Here's what we've got for our 3 searchable fields:
EDD_HTML_Elements::product_dropdown() Placeholder: Choose a Download Search placeholder: Type to search all DownloadsEDD_HTML_Elements::customer_dropdown() Placeholder: No Customer attached Search placeholder: Type to search all CustomersEDD_HTML_Elements::select() Placeholder: {value of placeholder argument} Search placeholder: Type to search all DownloadsThat last one is the problem. We need to either make that generic like "Type to search all items" or we need a second argument for customizing the string like search_placeholder.
This is going to take more than just an argument. Some of the issue falls back to the 'Chosen' library as well. We have some JS that tries to update the placeholder for chosen as well. So we might have to look at that as well.
This problem currently exists in EDD Message. When sending a message to a customer and selecting from their available email addresses, the placeholder says "Downloads". Just in case you wanted a live example.
Initial thoughts would be this:
'data' => array( 'search-type' => 'TYPE' ), to EDD_HTML_Elements::select()edd_vars to be filterable subsequently allowing someone to add a var for search_placeholder_TYPEThat would, in theory, work, even with the current JS.
We would just need to allow the edd_vars to be filterable
I think I'd like the data attribute to be the solution. I don't like the idea of muddying up the edd_vars with a bunch of filters for search types. This also lets us localize any of the placeholders to the specific item itself, where as with filter edd_vars it'll be on every page the vars are loaded.
tl:dr Option 1 :P
@brashrebel @cklosowski PR opened at #5828 and ready for testing
@sunnyratilal just played with this. It appears that the changes in EDD core are working so the search-placeholder value is being used in this branch. However, I can't get it to work in another plugin. This issue was opened because of this one and I just committed by attempt here. Can you take a look at that and see what I did wrong?
If you want to see that just activate EDD Message and go to Downloads - > Customers - > any customer - > Messages and then the email address select field at the top of the form. You'll notice that the search-placeholder attribute gets added as data-0="Type to search all email addresses" instead of data-search-placeholder="Type to search all email addresses" which is what it should be.
Thanks!
@brashrebel there is an issue in the EDD Message code. When I looked into it, your code was not defining the array key 'search-placeholder', it was passing in 0...I started editing it in PHPStorm and there were escape characters encoded within the array key so it was actually '/search-placeholder/', which caused it to be nulled and therefore 0 when it got to the array.
Editing this fixed the data attribute, Still not getting the placeholder to work, but at least your message code isn't broken, I've committed this to issue/10 for you.
@brashrebel @mintplugins This should be good now.
Confirmed fixed! 馃帀
Most helpful comment
Confirmed fixed! 馃帀