WordPress.org

Make WordPress Core

Changeset 43854


Ignore:
Timestamp:
11/01/2018 02:24:18 AM (13 months ago)
Author:
pento
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.

Props noisysocks.
Fixes #45247.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/src/wp-admin/includes/class-wp-posts-list-table.php

    r43728 r43854  
    12381238                __( 'Edit' )
    12391239            );
    1240             $actions['inline hide-if-no-js'] = sprintf(
    1241                 '<a href="#" class="editinline" aria-label="%s">%s</a>',
    1242                 /* translators: %s: post title */
    1243                 esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $title ) ),
    1244                 __( 'Quick&nbsp;Edit' )
    1245             );
     1240
     1241            if ( 'wp_block' !== $post->post_type ) {
     1242                $actions['inline hide-if-no-js'] = sprintf(
     1243                    '<a href="#" class="editinline" aria-label="%s">%s</a>',
     1244                    /* translators: %s: post title */
     1245                    esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $title ) ),
     1246                    __( 'Quick&nbsp;Edit' )
     1247                );
     1248            }
    12461249        }
    12471250
     
    12961299                );
    12971300            }
     1301        }
     1302
     1303        if ( 'wp_block' === $post->post_type ) {
     1304            $actions['export'] = sprintf(
     1305                '<button type="button" class="wp-list-reusable-blocks__export button-link" data-id="%s" aria-label="%s">%s</button>',
     1306                $post->ID,
     1307                /* translators: %s: post title */
     1308                esc_attr( sprintf( __( 'Export &#8220;%s&#8221; as JSON' ), $title ) ),
     1309                __( 'Export as JSON' )
     1310            );
    12981311        }
    12991312
Note: See TracChangeset for help on using the changeset viewer.