Make WordPress Core

Changes between Version 11 and Version 21 of Ticket #52920


Ignore:
Timestamp:
04/21/2021 08:33:58 AM (4 years ago)
Author:
gziolo
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #52920 – Description

    v11 v21  
    66
    77Changes included so far:
    8 - `wp-format-library` assets are always loaded for the block editor with the corresponding hook
     8- new method `get_default_block_categories` were introduced to make is possible to share default block categories
     9- new method `get_allowed_block_types` was introduced to handle filters depending on the editor type
    910- most of the settings that are defined on the client in the block editor package in https://github.com/WordPress/gutenberg/blob/trunk/packages/block-editor/src/store/defaults.js are already exposed from the new `get_default_block_editor_settings` method
     11- another method `get_block_editor_settings` got introduced to ensure that editor settings can be filtered depending on the editor type
    1012- the logic that preloads common data used with the block editor by processing an array of REST API paths is now abstracted in `block_editor_preload_api_requests` method
    1113
    1214All existing filters that depend on `$post` object get deprecated with `apply_filters_deprecated` as suggested by @jeremyfelt:
    1315- `allowed_block_types`
     16- `block_categories`
    1417- `block_editor_preload_paths`
    15 - `block_categories`
     18- `block_editor_settings`
    1619
    1720New filters are introduced that are context-aware:
     21- `allowed_block_types_all`
    1822- `allowed_block_types_{$editor_name}`
     23- `block_categories_all`
    1924- `block_editor_preload_paths_{$editor_name}`
    20 - `block_categories_{$editor_name}`
     25- `block_editor_settings_all`
     26- `block_editor_settings_{$editor_name}`
     27
     28In the case where there are two filters for a general use case that covers any editor type and a specific one, I followed #46187 and the implementation for `render_block` + `render_block_{$block_name}`. @johnbillion shared more examples in https://core.trac.wordpress.org/ticket/46187#comment:9:
     29
     30> This is a fairly common pattern in core, see for example: `gettext/gettext_{$domain}`, `plugin_action_links/plugin_action_links_{$plugin_file}`, `manage_posts_columns/manage_{$post_type}_posts_columns`, etc. The dynamically named filter should come after the generic one.