fix: extract name from the pods object

This commit is contained in:
Glen Whitney 2021-02-08 13:11:47 -08:00
parent 8043cc7739
commit e5b5ecaae6
2 changed files with 6 additions and 5 deletions

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.9 Version: 0.2.10
Author: Glen Whitney Author: Glen Whitney
Author URI: http://studioinfinity.org/ 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['export_format'] = ( ! empty( $_GET['export_format'] ) ) ? $_GET['export_format'] : false;
$data['csv_delimiters'] = $exporter->csv_delimiters; $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['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; $data['pod_name'] = ( ! empty( $_GET['pod_name'] ) ) ? $_GET['pod_name'] : false;
return $data; return $data;
} }

View File

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