From 81a1e48b914ddd76ee939a73e94d1eda85931bc0 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Mon, 8 Feb 2021 09:36:52 -0800 Subject: [PATCH] feat: Try to modify the TablePress menu --- README.md | 5 ++++- mkplugin.sh | 6 +++++- tablepress-pods.php | 19 ++++++++++++++++--- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ad3706e..9d00389 100644 --- a/README.md +++ b/README.md @@ -38,4 +38,7 @@ Note that the {}-expressions allowed in the entries of the table definition incl ##### Building -To produce an installable zip file, change directories into a git clone of this repository, and simply execute the command in mkplugin.sh (for example, via `bash mkplugin.sh`). Note that currently you must update the version number in the mkplugin.sh command. \ No newline at end of file +To produce an installable zip file, assuming you have cloned this repository: +1. Make sure that you have committed your changes with an update to the Version parameter in tablepress-pods.php. +1. Make sure the current git head is on the commit you want to build. +1. From the top-level directory of the repository, execute `bash mkplugin.sh`. diff --git a/mkplugin.sh b/mkplugin.sh index a530d7f..ab4f6e7 100644 --- a/mkplugin.sh +++ b/mkplugin.sh @@ -1 +1,5 @@ -git archive HEAD --prefix=tablepress-pods/ --format=zip -o tablepress-pods-0.2.zip +verline=$(grep Version tablepress-pods.php) +cvline=${verline//[$'\t\r\n']} +destfile="tablepress-pods-${cvline#V*: }.zip" +echo "Writing $destfile..." +git archive HEAD --prefix=tablepress-pods/ --format=zip -o $destfile diff --git a/tablepress-pods.php b/tablepress-pods.php index a96541a..9dca0d4 100644 --- a/tablepress-pods.php +++ b/tablepress-pods.php @@ -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 +Version: 0.2.3 Author: Glen Whitney Author URI: http ://studioinfinity.org/ */ @@ -58,12 +58,25 @@ Street, Fifth Floor, Boston, MA 02110-1301 , USA. add_filter( 'tablepress_shortcode_table_default_shortcode_atts', 'playground_add_shortcode_parameter_pods' ); add_filter( 'tablepress_table_raw_render_data', 'playground_expand_pod', 10, 2 ); +add_filter( 'tablepress_admin_view_actions', 'playground_add_export_pod_action') function playground_add_shortcode_parameter_pods( $default_atts ) { - $default_atts['pod_name'] = ''; + $default_atts['pod_name'] = ''; $default_atts['pod_dump'] = ''; $default_atts['pod_where'] = ''; - return $default_atts; + return $default_atts; +} + +function playground_add_export_pod_action( $view_actions ) { + $view_actions['exportpods'] = array( + 'show_entry' => true, + 'page_title' => __( 'Export Pods Table', 'tablepress' ), + 'admin_menu_title' => __( 'Export Pods Table', 'tablepress' ), + 'nav_tab_title' => _x( 'Export Pods', 'navigation bar', 'tablepress' ), + 'required_cap' => 'tablepress_export_tables', + ); + unset($view_actions['import']); + return $view_actions; } function playground_expand_pod( $table, $render_options) {