Add an "Export Pods Table" action to the TablePress menu #6

Merged
glen merged 18 commits from pods_export into main 2021-02-09 01:46:01 +00:00
Showing only changes of commit 0556eee2d5 - Show all commits

View File

@ -3,7 +3,7 @@
Plugin Name: TablePress Extension: Pods tables Plugin Name: TablePress Extension: Pods tables
Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods Plugin URI: https://code.studioinfinity.org/glen/tablepress-pods
Description: Custom Extension for TablePress to incorporate Pods information in tables Description: Custom Extension for TablePress to incorporate Pods information in tables
Version: 0.2.15 Version: 0.2.16
Author: Glen Whitney Author: Glen Whitney
Author URI: http://studioinfinity.org/ Author URI: http://studioinfinity.org/
*/ */
@ -204,10 +204,12 @@ function playground_handle_exportpods () {
$_REQUEST['_wpnonce'] = wp_create_nonce( TablePress::nonce( 'export' ) ); $_REQUEST['_wpnonce'] = wp_create_nonce( TablePress::nonce( 'export' ) );
/* Set up the filter using the pod params */ /* Set up the filter using the pod params */
$pod_name = $export['pod_name'] $r_opts = array('pod_name' => $export['pod_name']);
$filter = function( $data, $tab, $fmt, $delim ) use ($pod_name) { $filter = function( $data, $tab, $fmt, $delim ) use ($r_opts) {
return $data . "\nExpanded by " . $pod_name; $newtab = playground_expand_pod($tab, $r_opts);
} $exporter = TablePress::load_class( 'TablePress_Export', 'class-export.php', 'classes' );
return $exporter->export_table( $newtab, $fmt, $delim );
};
/* Temporarily set a filter on exporting */ /* Temporarily set a filter on exporting */
add_filter( 'tablepress_export_data', $filter, 10, 4); add_filter( 'tablepress_export_data', $filter, 10, 4);