Make WordPress Core


Ignore:
Timestamp:
12/17/2018 03:51:08 AM (6 years ago)
Author:
desrosj
Message:

Editor: Add custom fields meta box support in the block editor.

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

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

This does not bump the @wordpress packages like in [43861] because of conflicts with package versions already installed in trunk. The packages will be brought up to date in a subsequent merge.

Merges [43861] and [43863] into trunk.

See #45145.
Fixes #45257.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/wp-admin/edit-form-blocks.php

    r44251 r44260  
    203203}
    204204
     205// Image sizes.
     206$image_sizes   = get_intermediate_image_sizes();
     207$image_sizes[] = 'full';
     208
     209/** This filter is documented in wp-admin/includes/media.php */
     210$image_size_names = apply_filters(
     211    'image_size_names_choose',
     212    array(
     213        'thumbnail' => __( 'Thumbnail' ),
     214        'medium'    => __( 'Medium' ),
     215        'large'     => __( 'Large' ),
     216        'full'      => __( 'Full Size' ),
     217    )
     218);
     219
     220$available_image_sizes = array();
     221foreach ( $image_sizes as $image_size_slug ) {
     222    $available_image_sizes[] = array(
     223        'slug' => $image_size_slug,
     224        'name' => isset( $image_size_names[ $image_size_slug ] ) ? $image_size_names[ $image_size_slug ] : $image_size_slug,
     225    );
     226}
     227
    205228// Lock settings.
    206229$user_id = wp_check_post_lock( $post->ID );
     
    258281    'allowedMimeTypes'       => get_allowed_mime_types(),
    259282    'styles'                 => $styles,
     283    'availableImageSizes'    => $available_image_sizes,
    260284    'postLock'               => $lock_details,
    261285    'postLockUtils'          => array(
     
    264288        'ajaxUrl'     => admin_url( 'admin-ajax.php' ),
    265289    ),
     290
     291    // Whether or not to load the 'postcustom' meta box is stored as a user meta
     292    // field so that we're not always loading its assets.
     293    'enableCustomFields'     => (bool) get_user_meta( get_current_user_id(), 'enable_custom_fields', true ),
    266294);
    267295
Note: See TracChangeset for help on using the changeset viewer.