humanmade / asset-manager-framework

A framework for overriding the WordPress media library with an external asset provider, such as a DAM
GNU General Public License v2.0
155 stars 7 forks source link

Improve function portability for processing selections #52

Open roborourke opened 2 years ago

roborourke commented 2 years ago

Right now the ajax_select() function handles parsing the $_REQUEST global as well as creating the placeholder attachment post, follow up actions and returning a JSON response.

If this functionality were to be required for an import script, or script that converted local attachments to global ones for example, it would have to be recreated wholesale.

We should split ajax_select() into 2 functions, one that handles the $_REQUEST global and returning JSON, and one that accepts parameters necessary to create the local placeholder attachment posts for global images.