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
3 changed files with 25 additions and 5 deletions
Showing only changes of commit 81a1e48b91 - Show all commits

View File

@ -38,4 +38,7 @@ Note that the {}-expressions allowed in the entries of the table definition incl
##### Building ##### 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. 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`.

View File

@ -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

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 Version: 0.2.3
Author: Glen Whitney Author: Glen Whitney
Author URI: http ://studioinfinity.org/ 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', 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')
function playground_add_shortcode_parameter_pods( $default_atts ) { function playground_add_shortcode_parameter_pods( $default_atts ) {
$default_atts['pod_name'] = ''; $default_atts['pod_name'] = '';
$default_atts['pod_dump'] = ''; $default_atts['pod_dump'] = '';
$default_atts['pod_where'] = ''; $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) { function playground_expand_pod( $table, $render_options) {