[Plugin: Front-end Editor] new simple_fields_editable_image field problems
-
Hi Scribu,
I’ve been trying for hours to extend the editable_image field function so it can work with the file selector of the simple fields custom field UI plugin. Bascially, this involves saving the attachment ID of the newly selected image into the respective postmeta field when the “change image” button is clicked.
So I’ve been experimenting with your developer guide for new editable fields, but with limited success so far. I’m failing to pass new “data-“-elements (like the post_id and the postmeta key) to the “wrap”-function for some reason. I must be doing something wrong, apparently.
This is my field description –
register_fronted_field('simple_field_editable_image', array( 'class' => 'sf_FEE_Field_Image', 'title' => 'Simple Fields Editable Image', 'type' => 'image', 'argc' => 5 ));
this is my template function –
function sf_editable_image( $post_id, $sfid, $sfvalue, $key, $default_url, $extra_attr = '', $echo = true ) {...}
in sf_FEE_Field_Image, the wrapper function is
function wrap( $img, $post_id, $sfid, $sfvalue, $key ) { if ( !$this->check() ) return $img; return parent::wrap( $img, compact( 'post_id', 'sfid', 'sfvalue', 'key' ) ); }
Problem is, with this code, I get a JS post in which the keys are the first two arguments of the list in the wrap function, but with the values used by the Fee_Field_Image class (key and URL).
data[post_id] 111 data[sfid] https://server.tld/wordpress/wp-content/uploads/2010/09/test.jpg
I’d be grateful for a suggestion about what I’m doing wrong.
I’d also wondering if there is a simple way of modifying the JS used via functions.php? So far, I had to modify editor.dev.js so the post would return the attachment ID of the newly picked attachment.
Thanks for any help!
- The topic ‘[Plugin: Front-end Editor] new simple_fields_editable_image field problems’ is closed to new replies.