Add ability to "add in an event manually, or edit one" to the TNP auto-import block.
Building off GH-13, code from #15 , refactor to make the block allow an arbitrary number of events, all editable (and thus saved by TNP as data). The automatic part would be giving the user the option to "import" events into the list, with the data pre-filled.
So, start by making an events-list with arbitrary number of events, which sensible markup that a script can read/create. Need an "add" button. Reordering events is likely need as well.
"Auto" import would require making an AJAX call from our TNP edit panel, to create items in the list. The AJAX call would need to be routed through WP, rather than to CES directly, because of CORS. The admin-ajax endpoint must return only the fields required for the block, because doing otherwise (saving the entire JSON payload) will run into upload size limits in PHP when it comes time to save the events list (the POST request size was ~ 32 KB for a prototype I made before).
So, add a separate button in the editor panel that triggers the import event, rather than running it every time the block is generated, as was done for GH-13's simpler implementation.
Add ability to "add in an event manually, or edit one" to the TNP auto-import block.
Building off GH-13, code from #15 , refactor to make the block allow an arbitrary number of events, all editable (and thus saved by TNP as data). The automatic part would be giving the user the option to "import" events into the list, with the data pre-filled.
So, start by making an events-list with arbitrary number of events, which sensible markup that a script can read/create. Need an "add" button. Reordering events is likely need as well.
"Auto" import would require making an AJAX call from our TNP edit panel, to create items in the list. The AJAX call would need to be routed through WP, rather than to CES directly, because of CORS. The admin-ajax endpoint must return only the fields required for the block, because doing otherwise (saving the entire JSON payload) will run into upload size limits in PHP when it comes time to save the events list (the POST request size was ~ 32 KB for a prototype I made before).
So, add a separate button in the editor panel that triggers the import event, rather than running it every time the block is generated, as was done for GH-13's simpler implementation.