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
2 changed files with 6 additions and 5 deletions
Showing only changes of commit e5b5ecaae6 - Show all commits

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.9
Version: 0.2.10
Author: Glen Whitney
Author URI: http://studioinfinity.org/
*/
@ -103,7 +103,7 @@ function playground_exportpods_data( $data, $act ) {
$data['export_format'] = ( ! empty( $_GET['export_format'] ) ) ? $_GET['export_format'] : false;
$data['csv_delimiters'] = $exporter->csv_delimiters;
$data['csv_delimiter'] = ( ! empty( $_GET['csv_delimiter'] ) ) ? $_GET['csv_delimiter'] : _x( ',', 'Default CSV delimiter in the translated language (";", ",", or "tab")', 'tablepress' );
$data['pod_names'] = pods_api()->load_pods();
$data['pods'] = pods_api()->load_pods();
$data['pod_name'] = ( ! empty( $_GET['pod_name'] ) ) ? $_GET['pod_name'] : false;
return $data;
}

View File

@ -161,9 +161,10 @@ class TablePress_ExportPods_View extends TablePress_View {
<td class="column-2">
<select id="tables-export-pod-name" name="export[pod_name]">
<?php
foreach ( $data['pod_names'] as $pod) {
$selected = selected( $pod, $data['pod_name'], false );
echo "<option{$selected} value=\"{$pod}\"?{$pod}</option>";
foreach ( $data['pods'] as $pod) {
$pod_name = $pod['name];
$selected = selected( $pod_name, $data['pod_name'], false );
echo "<option{$selected} value=\"{$pod_name}\"?{$pod_name}</option>";
}
?>
</select>