fix: add filter to redirect exportpods view here

This commit is contained in:
Glen Whitney 2021-02-08 10:34:03 -08:00
parent 7e05603dd1
commit 0307f2897a

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.4 Version: 0.2.5
Author: Glen Whitney Author: Glen Whitney
Author URI: http ://studioinfinity.org/ Author URI: http ://studioinfinity.org/
*/ */
@ -58,7 +58,8 @@ Street, Fifth Floor, Boston, MA 02110-1301 , USA.
add_filter( 'tablepress_shortcode_table_default_shortcode_atts', add_filter( 'tablepress_shortcode_table_default_shortcode_atts',
'playground_add_shortcode_parameter_pods' ); 'playground_add_shortcode_parameter_pods' );
add_filter( 'tablepress_table_raw_render_data', 'playground_expand_pod', 10, 2 ); add_filter( 'tablepress_table_raw_render_data', 'playground_expand_pod', 10, 2 );
add_filter( 'tablepress_admin_view_actions', 'playground_add_export_pod_action') add_filter( 'tablepress_admin_view_actions', 'playground_add_export_pod_action');
add_filter( 'tablepress_load_file_full_path', 'playground_exportpods_path');
function playground_add_shortcode_parameter_pods( $default_atts ) { function playground_add_shortcode_parameter_pods( $default_atts ) {
$default_atts['pod_name'] = ''; $default_atts['pod_name'] = '';
@ -75,10 +76,14 @@ function playground_add_export_pod_action( $view_actions ) {
'nav_tab_title' => _x( 'Export Pods', 'navigation bar', 'tablepress' ), 'nav_tab_title' => _x( 'Export Pods', 'navigation bar', 'tablepress' ),
'required_cap' => 'tablepress_export_tables', 'required_cap' => 'tablepress_export_tables',
); );
/* unset($view_actions['import']); */
return $view_actions; return $view_actions;
} }
function playground_exportpods_path( $fullpath, $filename, $directory ) {
if ($filename !== 'view-exportpods.php') return $fullpath;
return plugin_dir_path( __FILE__ ) . $filename;
}
function playground_expand_pod( $table, $render_options) { function playground_expand_pod( $table, $render_options) {
if (empty($render_options['pod_name'])) return $table; if (empty($render_options['pod_name'])) return $table;
$pod_params = array('limit'=>-1); $pod_params = array('limit'=>-1);