[wp-trac] [WordPress Trac] #24865: Allow plugins to hook into autosave and include field data from the autosave with the package.
WordPress Trac
noreply at wordpress.org
Sun Jul 28 22:55:44 UTC 2013
#24865: Allow plugins to hook into autosave and include field data from the
autosave with the package.
----------------------------+-----------------------------
Reporter: nerrad | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version:
Severity: normal | Keywords: has-patch
----------------------------+-----------------------------
== Why? ==
Autosaves currently only save "blessed" data (post_title and
post_description?). Plugin authors may want to add their own data in the
autosave package so if they hook into `save_post` they can handle/save
that data as needed.
== How this works ==
Metaboxes are generated with an id already on the page. So what we do is
add an extra parameter to the `add_meta_box()` function (`do_autosave`
bool) so that when a plugin uses add_meta_box() they can set that flag.
We set a javascript object that contains the ids of the metaboxes that
have had that flag set and then `wp.autosave.getPostData` in `autosave.js`
has been modified to loop through the metaboxes matching those ids and
return the fields in those metaboxes as an object attached to the data
param.
Added a new jquery plugin (serializefullarray) as it will handle nested
pseudo arrays set as the "name" values in inputs (i.e. somedata[one][two])
and create proper objects from them.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/24865>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list