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.

Built from https://develop.svn.wordpress.org/trunk@44220


git-svn-id: http://core.svn.wordpress.org/trunk@44050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Jeremy Felt 2018-12-17 03:01:05 +00:00
parent fc22863570
commit b93dd61e90
3 changed files with 21 additions and 8 deletions

View File

@ -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(
'<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
/* translators: %s: post title */
esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $title ) ),
__( 'Quick&nbsp;Edit' )
);
if ( 'wp_block' !== $post->post_type ) {
$actions['inline hide-if-no-js'] = sprintf(
'<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
/* translators: %s: post title */
esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $title ) ),
__( 'Quick&nbsp;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(
'<button type="button" class="wp-list-reusable-blocks__export button-link" data-id="%s" aria-label="%s">%s</button>',
$post->ID,
/* translators: %s: post title */
esc_attr( sprintf( __( 'Export &#8220;%s&#8221; as JSON' ), $title ) ),
__( 'Export as JSON' )
);
}
if ( is_post_type_hierarchical( $post->post_type ) ) {
/**

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.1-alpha-44219';
$wp_version = '5.1-alpha-44220';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.