From 779c3c5f9deed1dc0593fb098303fb4da41b8c78 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Tue, 18 Sep 2018 16:40:27 +0200 Subject: [PATCH] Improve the reusable blocks Export as JSON link. (#10003) --- gutenberg.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/gutenberg.php b/gutenberg.php index e35e7dfff66c9c..15c1cbcce7a8ce 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -257,13 +257,22 @@ function gutenberg_add_edit_link_filters() { * @return array Updated post actions. */ function gutenberg_add_edit_link( $actions, $post ) { + // Build the classic edit action. See also: WP_Posts_List_Table::handle_row_actions(). + $title = _draft_or_post_title( $post->ID ); + if ( 'wp_block' === $post->post_type ) { unset( $actions['edit'] ); unset( $actions['inline hide-if-no-js'] ); $actions['export'] = sprintf( - '%s', + '', $post->ID, - __( 'Export as JSON', 'gutenberg' ), + esc_attr( + sprintf( + /* translators: %s: post title */ + __( 'Export “%s” as JSON', 'gutenberg' ), + $title + ) + ), __( 'Export as JSON', 'gutenberg' ) ); return $actions; @@ -276,8 +285,6 @@ function gutenberg_add_edit_link( $actions, $post ) { $edit_url = get_edit_post_link( $post->ID, 'raw' ); $edit_url = add_query_arg( 'classic-editor', '', $edit_url ); - // Build the classic edit action. See also: WP_Posts_List_Table::handle_row_actions(). - $title = _draft_or_post_title( $post->ID ); $edit_action = array( 'classic' => sprintf( '%s',