From c9c6beb3f371c09ca506f02417526f2570fe033e Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Sun, 16 Dec 2018 01:48:05 +0000 Subject: [PATCH] Blocks: Add "Export as JSON" action to the `wp_block` post list screen. Remove the "Quick Edit" for `wp_block`s, too, as they don't need any of that functionality. Merges [43854] from the 5.0 branch to trunk. Props noisysocks. Fixes #45247. git-svn-id: https://develop.svn.wordpress.org/trunk@44220 602fd350-edb4-49c9-b593-d223f7449a82 --- .../includes/class-wp-posts-list-table.php | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php index a70a32e3ed..315831bdd2 100644 --- a/src/wp-admin/includes/class-wp-posts-list-table.php +++ b/src/wp-admin/includes/class-wp-posts-list-table.php @@ -1268,12 +1268,15 @@ class WP_Posts_List_Table extends WP_List_Table { esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ), __( 'Edit' ) ); - $actions['inline hide-if-no-js'] = sprintf( - '', - /* translators: %s: post title */ - esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $title ) ), - __( 'Quick Edit' ) - ); + + if ( 'wp_block' !== $post->post_type ) { + $actions['inline hide-if-no-js'] = sprintf( + '', + /* translators: %s: post title */ + esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $title ) ), + __( 'Quick Edit' ) + ); + } } if ( current_user_can( 'delete_post', $post->ID ) ) { @@ -1328,6 +1331,16 @@ class WP_Posts_List_Table extends WP_List_Table { } } + if ( 'wp_block' === $post->post_type ) { + $actions['export'] = sprintf( + '', + $post->ID, + /* translators: %s: post title */ + esc_attr( sprintf( __( 'Export “%s” as JSON' ), $title ) ), + __( 'Export as JSON' ) + ); + } + if ( is_post_type_hierarchical( $post->post_type ) ) { /**