Skip to content

Commit

Permalink
Site Editor: Remove unused PHP code (#36997)
Browse files Browse the repository at this point in the history
* Site Editor: Remove unused PHP code

* Remove templates edit link tests

* Remove moved files

* Remove filters
  • Loading branch information
Mamaduka authored and noisysocks committed Dec 6, 2021
1 parent c004637 commit 8c8964f
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 153 deletions.
30 changes: 0 additions & 30 deletions lib/compat/wordpress-5.9/template-parts.php
Expand Up @@ -100,36 +100,6 @@ function gutenberg_register_wp_template_part_area_taxonomy() {
}
add_action( 'init', 'gutenberg_register_wp_template_part_area_taxonomy' );

/**
* Fixes the label of the 'wp_template_part' admin menu entry.
*/
function gutenberg_fix_template_part_admin_menu_entry() {
if ( ! gutenberg_supports_block_templates() ) {
return;
}

global $submenu;
if ( ! isset( $submenu['themes.php'] ) ) {
return;
}
$post_type = get_post_type_object( 'wp_template_part' );
if ( ! $post_type ) {
return;
}
foreach ( $submenu['themes.php'] as $key => $submenu_entry ) {
if ( $post_type->labels->all_items === $submenu['themes.php'][ $key ][0] ) {
$submenu['themes.php'][ $key ][0] = $post_type->labels->menu_name; // phpcs:ignore WordPress.WP.GlobalVariablesOverride
break;
}
}
}
add_action( 'admin_menu', 'gutenberg_fix_template_part_admin_menu_entry' );

// Customize the `wp_template` admin list.
add_filter( 'manage_wp_template_part_posts_columns', 'gutenberg_templates_lists_custom_columns' );
add_action( 'manage_wp_template_part_posts_custom_column', 'gutenberg_render_templates_lists_custom_column', 10, 2 );
add_filter( 'views_edit-wp_template_part', 'gutenberg_filter_templates_edit_views' );

/**
* Sets a custom slug when creating auto-draft template parts.
* This is only needed for auto-drafts created by the regular WP editor.
Expand Down
29 changes: 0 additions & 29 deletions lib/compat/wordpress-5.9/templates.php
Expand Up @@ -127,35 +127,6 @@ function gutenberg_grant_template_caps( array $allcaps ) {
}
add_filter( 'user_has_cap', 'gutenberg_grant_template_caps' );

/**
* Fixes the label of the 'wp_template' admin menu entry.
*/
function gutenberg_fix_template_admin_menu_entry() {
if ( ! gutenberg_supports_block_templates() ) {
return;
}
global $submenu;
if ( ! isset( $submenu['themes.php'] ) ) {
return;
}
$post_type = get_post_type_object( 'wp_template' );
if ( ! $post_type ) {
return;
}
foreach ( $submenu['themes.php'] as $key => $submenu_entry ) {
if ( $post_type->labels->all_items === $submenu['themes.php'][ $key ][0] ) {
$submenu['themes.php'][ $key ][0] = $post_type->labels->menu_name; // phpcs:ignore WordPress.WP.GlobalVariablesOverride
break;
}
}
}
add_action( 'admin_menu', 'gutenberg_fix_template_admin_menu_entry' );

// Customize the `wp_template` admin list.
add_filter( 'manage_wp_template_posts_columns', 'gutenberg_templates_lists_custom_columns' );
add_action( 'manage_wp_template_posts_custom_column', 'gutenberg_render_templates_lists_custom_column', 10, 2 );
add_filter( 'views_edit-wp_template', 'gutenberg_filter_templates_edit_views' );

/**
* Sets a custom slug when creating auto-draft templates.
* This is only needed for auto-drafts created by the regular WP editor.
Expand Down
93 changes: 0 additions & 93 deletions lib/full-site-editing/templates-utils.php

This file was deleted.

1 change: 0 additions & 1 deletion lib/load.php
Expand Up @@ -109,7 +109,6 @@ function gutenberg_is_experiment_enabled( $name ) {
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/templates-utils.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 8c8964f

Please sign in to comment.