Make WordPress Core


Ignore:
Timestamp:
11/03/2018 07:56:28 AM (7 years ago)
Author:
pento
Message:

Build Tools: Update the @wordpress packages.

This brings support for the custom fields meta box to the block editor.

The webpack and copy-webpack-plugin packages have also been updated.

See #45145.
Fixes #45257.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/5.0/src/wp-admin/includes/post.php

    r43858 r43861  
    19591959            'slug'  => 'common',
    19601960            'title' => __( 'Common Blocks' ),
    1961             'icon'  => 'screenoptions',
     1961            'icon'  => null,
    19621962        ),
    19631963        array(
     
    20612061    <?php the_block_editor_meta_box_post_form_hidden_fields( $post ); ?>
    20622062    </form>
     2063    <form id="toggle-custom-fields-form" method="post" action="<?php echo esc_attr( admin_url( 'post.php' ) ); ?>">
     2064        <?php wp_nonce_field( 'toggle-custom-fields' ); ?>
     2065        <input type="hidden" name="action" value="toggle-custom-fields" />
     2066    </form>
    20632067    <?php foreach ( $locations as $location ) : ?>
    20642068        <form class="metabox-location-<?php echo esc_attr( $location ); ?>">
     
    21362140    }
    21372141
     2142    /**
     2143     * If the 'postcustom' meta box is enabled, then we need to perform some
     2144     * extra initialization on it.
     2145     */
     2146    $enable_custom_fields = (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true );
     2147    if ( $enable_custom_fields ) {
     2148        $script = "( function( $ ) {
     2149            if ( $('#postcustom').length ) {
     2150                $( '#the-list' ).wpList( {
     2151                    addBefore: function( s ) {
     2152                        s.data += '&post_id=$post->ID';
     2153                        return s;
     2154                    },
     2155                    addAfter: function() {
     2156                        $('table#list-table').show();
     2157                    }
     2158                });
     2159            }
     2160        } )( jQuery );";
     2161        wp_enqueue_script( 'wp-lists' );
     2162        wp_add_inline_script( 'wp-lists', $script );
     2163    }
     2164
    21382165    // Reset meta box data.
    21392166    $wp_meta_boxes = $_original_meta_boxes;
Note: See TracChangeset for help on using the changeset viewer.