Make WordPress Core


Ignore:
Timestamp:
06/26/2023 08:55:31 AM (3 years ago)
Author:
isabel_brison
Message:

Editor: rename reusable blocks to patterns.

Renames the Reusable blocks to Patterns and adds an option to convert a block or collection of blocks to a non-synced Pattern.

Props glendaviesnz, ramonopoly, peterwilsoncc, timothyblynjacobs, flixos90.
Fixes #58577.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r55990 r56030  
    283283        array(
    284284            'labels'                => array(
    285                 'name'                     => _x( 'Reusable blocks', 'post type general name' ),
    286                 'singular_name'            => _x( 'Reusable block', 'post type singular name' ),
    287                 'add_new'                  => _x( 'Add New', 'Reusable block' ),
    288                 'add_new_item'             => __( 'Add new Reusable block' ),
    289                 'new_item'                 => __( 'New Reusable block' ),
    290                 'edit_item'                => __( 'Edit Reusable block' ),
    291                 'view_item'                => __( 'View Reusable block' ),
    292                 'view_items'               => __( 'View Reusable blocks' ),
    293                 'all_items'                => __( 'All Reusable blocks' ),
    294                 'search_items'             => __( 'Search Reusable blocks' ),
    295                 'not_found'                => __( 'No reusable blocks found.' ),
    296                 'not_found_in_trash'       => __( 'No reusable blocks found in Trash.' ),
    297                 'filter_items_list'        => __( 'Filter reusable blocks list' ),
    298                 'items_list_navigation'    => __( 'Reusable blocks list navigation' ),
    299                 'items_list'               => __( 'Reusable blocks list' ),
    300                 'item_published'           => __( 'Reusable block published.' ),
    301                 'item_published_privately' => __( 'Reusable block published privately.' ),
    302                 'item_reverted_to_draft'   => __( 'Reusable block reverted to draft.' ),
    303                 'item_scheduled'           => __( 'Reusable block scheduled.' ),
    304                 'item_updated'             => __( 'Reusable block updated.' ),
     285                'name'                     => _x( 'Patterns', 'post type general name' ),
     286                'singular_name'            => _x( 'Pattern', 'post type singular name' ),
     287                'add_new'                  => _x( 'Add New', 'Pattern' ),
     288                'add_new_item'             => __( 'Add new Pattern' ),
     289                'new_item'                 => __( 'New Pattern' ),
     290                'edit_item'                => __( 'Edit Pattern' ),
     291                'view_item'                => __( 'View Pattern' ),
     292                'view_items'               => __( 'View Patterns' ),
     293                'all_items'                => __( 'All Patterns' ),
     294                'search_items'             => __( 'Search Patterns' ),
     295                'not_found'                => __( 'No patterns found.' ),
     296                'not_found_in_trash'       => __( 'No patterns found in Trash.' ),
     297                'filter_items_list'        => __( 'Filter patterns list' ),
     298                'items_list_navigation'    => __( 'Patterns list navigation' ),
     299                'items_list'               => __( 'Patterns list' ),
     300                'item_published'           => __( 'Pattern published.' ),
     301                'item_published_privately' => __( 'Pattern published privately.' ),
     302                'item_reverted_to_draft'   => __( 'Pattern reverted to draft.' ),
     303                'item_scheduled'           => __( 'Pattern scheduled.' ),
     304                'item_updated'             => __( 'Pattern updated.' ),
    305305            ),
    306306            'public'                => false,
     
    329329                'editor',
    330330                'revisions',
     331                'custom-fields',
    331332            ),
    332333        )
     
    80198020    return apply_filters( 'use_block_editor_for_post_type', true, $post_type );
    80208021}
     8022
     8023/**
     8024 * Registers any additional post meta fields.
     8025 *
     8026 * @since 6.3.0 Adds sync_status meta field to the wp_block post type so an unsynced option can be added.
     8027 *
     8028 * @link https://github.com/WordPress/gutenberg/pull/51144
     8029 */
     8030function wp_create_initial_post_meta() {
     8031    register_post_meta(
     8032        'wp_block',
     8033        'sync_status',
     8034        array(
     8035            'sanitize_callback' => 'sanitize_text_field',
     8036            'single'            => true,
     8037            'type'              => 'string',
     8038            'show_in_rest'      => array(
     8039                'schema' => array(
     8040                    'type' => 'string',
     8041                    'enum' => array( 'partial', 'unsynced' ),
     8042                ),
     8043            ),
     8044        )
     8045    );
     8046}
Note: See TracChangeset for help on using the changeset viewer.