[wp-trac] [WordPress Trac] #16392: Quick Edit API should allow to pick up custom field values automatically

WordPress Trac wp-trac at lists.automattic.com
Sun Feb 19 03:07:49 UTC 2012


#16392: Quick Edit API should allow to pick up custom field values automatically
-------------------------------+-----------------------------
 Reporter:  Denis-de-Bernardy  |       Owner:
     Type:  enhancement        |      Status:  new
 Priority:  normal             |   Milestone:  Future Release
Component:  Quick/Bulk Edit    |     Version:  3.1
 Severity:  normal             |  Resolution:
 Keywords:  needs-patch        |
-------------------------------+-----------------------------

Comment (by outis):

 Denis' points are addressed by template.php.patch and inline-edit-
 post.dev.js.patch, now attached to this ticket. To automatically update
 custom inputs, the data elements added in the 'get_inline_data' hook must
 have a "for" attribute set to the "name" of the input. For example:

 {{{
 function add_inline_data($post) {
     foreach (array('foo', 'bar', 'baz') as $field) {
         $value = esc_html(get_post_meta($post->ID, $field, TRUE));
         echo "<div for='$field'>$value</div>";
     }
 }
 add_action('get_inline_data', 'add_inline_data');

 /* ensures quick_edit_custom_box is triggered */
 function add_quickedit_column($cols) {
     $cols['quickedit'] = __('Quickedit Data');
     return $cols;
 }
 add_filter('manage_posts_columns', 'add_quickedit_column');


 function display_custom_quick($column_name, $type) {
     if ($column_name !== 'quickedit') {
         return;
     }
     ?>
     <fieldset class="inline-edit-col-right">
       <div class="inline-edit-col inline-edit-<?php echo $column_name ?>">
         <?php foreach (array('foo', 'bar', 'baz') as $field) { ?>
           <label for="<?php echo $field ?>"><?php echo ucfirst($field)
 ?></label>
           <input name="<?php echo $field ?>" />
         <?php } ?>
       </div>
     </fieldset>
     <?php
 }
 add_action('quick_edit_custom_box', 'display_custom_quick');
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16392#comment:15>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list