Skip to content

Commit

Permalink
Better synchronisation between Gutenberg and Core code (#37141)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad authored and noisysocks committed Dec 13, 2021
1 parent 925c85a commit 34f3f4c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,7 @@ function gutenberg_filter_wp_template_unique_post_slug( $override_slug, $slug, $

return $override_slug;
}

// Remove 5.8 filter if existant.
remove_filter( 'pre_wp_unique_post_slug', 'wp_filter_wp_template_unique_post_slug' );
add_filter( 'pre_wp_unique_post_slug', 'gutenberg_filter_wp_template_unique_post_slug', 10, 5 );
40 changes: 0 additions & 40 deletions lib/full-site-editing/default-template-types.php

This file was deleted.

8 changes: 7 additions & 1 deletion lib/full-site-editing/edit-site-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,17 @@ static function( $classes ) {
*/
$current_screen->is_block_editor( true );

$indexed_template_types = array();
foreach ( get_default_block_template_types() as $slug => $template_type ) {
$template_type['slug'] = (string) $slug;
$indexed_template_types[] = $template_type;
}

$custom_settings = array(
'siteUrl' => site_url(),
'postsPerPage' => get_option( 'posts_per_page' ),
'styles' => gutenberg_get_editor_styles(),
'defaultTemplateTypes' => gutenberg_get_indexed_default_template_types(),
'defaultTemplateTypes' => $indexed_template_types,
'defaultTemplatePartAreas' => get_allowed_block_template_part_areas(),
'__experimentalBlockPatterns' => WP_Block_Patterns_Registry::get_instance()->get_all_registered(),
'__experimentalBlockPatternCategories' => WP_Block_Pattern_Categories_Registry::get_instance()->get_all_registered(),
Expand Down
4 changes: 2 additions & 2 deletions lib/full-site-editing/template-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ function gutenberg_add_template_loader_filters() {
if ( ! gutenberg_supports_block_templates() ) {
return;
}

foreach ( gutenberg_get_template_type_slugs() as $template_type ) {
$template_type_slugs = array_keys( get_default_block_template_types() );
foreach ( $template_type_slugs as $template_type ) {
if ( 'embed' === $template_type ) { // Skip 'embed' for now because it is not a regular template type.
continue;
}
Expand Down
7 changes: 1 addition & 6 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,12 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-5.9/get-global-styles-and-settings.php';
require __DIR__ . '/compat/wordpress-5.9/json-file-decode.php';
require __DIR__ . '/compat/wordpress-5.9/translate-settings-using-i18n-schema.php';
require __DIR__ . '/compat/wordpress-5.9/theme-templates.php';
require __DIR__ . '/editor-settings.php';

// These are used by some FSE features
// as well as global styles.
require __DIR__ . '/compat/wordpress-5.9/class-wp-theme-json-schema-gutenberg.php';
require __DIR__ . '/compat/wordpress-5.9/class-wp-theme-json-gutenberg.php';
require __DIR__ . '/compat/wordpress-5.9/class-wp-theme-json-resolver-gutenberg.php';

require __DIR__ . '/full-site-editing/full-site-editing.php';
require __DIR__ . '/full-site-editing/block-templates.php';
require __DIR__ . '/full-site-editing/default-template-types.php';
require __DIR__ . '/full-site-editing/page-templates.php';
require __DIR__ . '/full-site-editing/template-loader.php';
require __DIR__ . '/full-site-editing/edit-site-page.php';
Expand Down

0 comments on commit 34f3f4c

Please sign in to comment.