feat: actually expand the table by the selected pod

This commit is contained in:
Glen Whitney 2021-02-08 16:08:24 -08:00
parent d1ace607bf
commit 0556eee2d5
1 changed files with 7 additions and 5 deletions

View File

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