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 21 additions and 2 deletions
Showing only changes of commit 4a73e0551f - Show all commits

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.16 Version: 0.2.17
Author: Glen Whitney Author: Glen Whitney
Author URI: http://studioinfinity.org/ Author URI: http://studioinfinity.org/
*/ */
@ -204,7 +204,12 @@ function playground_handle_exportpods () {
$_REQUEST['_wpnonce'] = wp_create_nonce( TablePress::nonce( 'export' ) ); $_REQUEST['_wpnonce'] = wp_create_nonce( TablePress::nonce( 'export' ) );
/* Set up the filter using the pod params */ /* Set up the filter using the pod params */
$r_opts = array('pod_name' => $export['pod_name']); $r_opts = array('pod_name' => $export['pod_name'],
'pod_where' => $export['pod_where']
);
if ( isset( $export['pod_dump'] ) ) {
$r_opts['pod_dump'] = true;
}
$filter = function( $data, $tab, $fmt, $delim ) use ($r_opts) { $filter = function( $data, $tab, $fmt, $delim ) use ($r_opts) {
$newtab = playground_expand_pod($tab, $r_opts); $newtab = playground_expand_pod($tab, $r_opts);
$exporter = TablePress::load_class( 'TablePress_Export', 'class-export.php', 'classes' ); $exporter = TablePress::load_class( 'TablePress_Export', 'class-export.php', 'classes' );

View File

@ -170,6 +170,20 @@ class TablePress_ExportPods_View extends TablePress_View {
</select> </select>
</td> </td>
</tr> </tr>
<tr>
<th class="column-1" scope="row"><label for="tables-export-pod-where"><?php _e( 'Pod "where" clause', 'tablepress'); ?>:</label></th>
<td class="column-2">
<input id="tables-export-pod-where" name="export[pod_where]" value="" />
<span id="tables-export-pod-where-description" class="description hide-if-js"><?php _e( '(Text passed to pod_where() to filter Pod records.)', 'tablepress' ); ?></span>
</td>
</tr>
<tr>
<th class="column-1" scope="row"><label for="tables-export-pod-dump"><?php _e( 'Dump Pod?', 'tablepress'); ?>:</label></th>
<td class="column-2">
<input type="checkbox" id="tables-export-pod-dump" name="export[pod_dump]" />
<span id="tables-export-pod-dump-description" class="description hide-if-js"><?php _e( '(If checked, ignores the table and simply dumps all Pod records.)', 'tablepress' ); ?></span>
</td>
</tr>
</tbody> </tbody>
</table> </table>
<?php <?php