Changeset 875742
- Timestamp:
- 03/15/2014 02:18:55 AM (12 years ago)
- File:
-
- 1 edited
-
somatic-framework/trunk/inc/somaMetaboxes.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
somatic-framework/trunk/inc/somaMetaboxes.php
r790352 r875742 7 7 add_action( 'add_meta_boxes_post', array(__CLASS__, 'add_boxes'), 10, 1 ); // use our somatic metabox rendering for core post type 8 8 add_action( 'add_meta_boxes_page', array(__CLASS__, 'add_boxes'), 10, 1 ); // use our somatic metabox rendering for core page type 9 add_filter( 'redirect_post_location', array(__CLASS__, 'redirect_post_location' ), 20, 2 ); 9 10 } 10 11 … … 14 15 } 15 16 17 // modify redirect behavior after post saving 18 function redirect_post_location($location, $pid) { 19 if (soma_fetch_index($_POST, 'save_and_go_back')) { 20 $location = soma_fetch_index($_POST, 'referredby'); 21 } 22 return $location; 23 } 16 24 17 25 static $data = array(); // container for other plugins and themes to store custom metabox and field data - SHOULD WE STORE THIS IN THE DB INSTEAD??? … … 84 92 id - (when data is taxonomy, this id must match the taxonomy slug!) 85 93 type - (see below) 86 data - meta, taxonomy, core, p2p, attachment, [save, link (only buttons)]94 data - meta, taxonomy, core, p2p, attachment, [save, save-back, link (only buttons)] 87 95 options - array of name => value pairs 88 96 once - only allows data to be set one time, then becomes readonly … … 1004 1012 // ----------------------------------------------------------------------------------------------------------------------------- // 1005 1013 case 'button': 1006 if ($field['data'] == 'save') {1014 if ($field['data'] == ( 'save' || 'save-back' ) ) { 1007 1015 if ($meta_box['always-publish'] || $meta_box['publish']) { 1008 1016 echo '<input type="hidden" name="post_status" id="post_status" value="publish" />'; 1017 } 1018 if ($field['data'] == 'save-back') { 1019 echo '<input type="hidden" name="save_and_go_back" value="1">'; // additional var to redirect back to referring page, detected by redirect_post_location() function 1009 1020 } 1010 1021 submit_button( $field['options']['label'], 'clicker', 'save', false, array( 'id' => $field["id"])); // outputs generic submit button
Note: See TracChangeset
for help on using the changeset viewer.