WordPress.org

Make WordPress Core

Changeset 44220


Ignore:
Timestamp:
12/16/2018 01:48:05 AM (9 months ago)
Author:
jeremyfelt
Message:

Blocks: Add "Export as JSON" action to the wp_block post list screen.

Remove the "Quick Edit" for wp_blocks, too, as they don't need any of that functionality.

Merges [43854] from the 5.0 branch to trunk.

Props noisysocks.
Fixes #45247.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/wp-admin/includes/class-wp-posts-list-table.php

    r43664 r44220  
    12691269                __( 'Edit' )
    12701270            );
    1271             $actions['inline hide-if-no-js'] = sprintf(
    1272                 '<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
    1273                 /* translators: %s: post title */
    1274                 esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $title ) ),
    1275                 __( 'Quick&nbsp;Edit' )
    1276             );
     1271
     1272            if ( 'wp_block' !== $post->post_type ) {
     1273                $actions['inline hide-if-no-js'] = sprintf(
     1274                    '<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
     1275                    /* translators: %s: post title */
     1276                    esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $title ) ),
     1277                    __( 'Quick&nbsp;Edit' )
     1278                );
     1279            }
    12771280        }
    12781281
     
    13271330                );
    13281331            }
     1332        }
     1333
     1334        if ( 'wp_block' === $post->post_type ) {
     1335            $actions['export'] = sprintf(
     1336                '<button type="button" class="wp-list-reusable-blocks__export button-link" data-id="%s" aria-label="%s">%s</button>',
     1337                $post->ID,
     1338                /* translators: %s: post title */
     1339                esc_attr( sprintf( __( 'Export &#8220;%s&#8221; as JSON' ), $title ) ),
     1340                __( 'Export as JSON' )
     1341            );
    13291342        }
    13301343
Note: See TracChangeset for help on using the changeset viewer.