Move the code that syncs CF edits to a function

This code keeps CFs which are in multiple groupings (and thus show up
more than 1 time on an edit page) in sync while you type/select.

If you display a CF for editing after a page loads (say from a JS
lightbox) you need to re-trigger this, so make it a function that other
things can call, rather than an inline function.
Merge branch '4.2/functionalize-custom-field-syncing' into 4.2-trunk