-
Notifications
You must be signed in to change notification settings - Fork 0
Dev Inspector #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ryanwelcher
wants to merge
1
commit into
trunk
Choose a base branch
from
feature/dev-inspector
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # This file is for unifying the coding style for different editors and IDEs | ||
| # editorconfig.org | ||
|
|
||
| # WordPress Coding Standards | ||
| # https://make.wordpress.org/core/handbook/coding-standards/ | ||
|
|
||
| root = true | ||
|
|
||
| [*] | ||
| charset = utf-8 | ||
| end_of_line = lf | ||
| insert_final_newline = true | ||
| trim_trailing_whitespace = true | ||
| indent_style = tab | ||
|
|
||
| [*.{yml,yaml}] | ||
| indent_style = space | ||
| indent_size = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
|
|
||
| # Coverage directory used by tools like istanbul | ||
| coverage | ||
|
|
||
| # Compiled binary addons (https://nodejs.org/api/addons.html) | ||
| build/Release | ||
|
|
||
| # Dependency directories | ||
| node_modules/ | ||
|
|
||
| # Optional npm cache directory | ||
| .npm | ||
|
|
||
| # Optional eslint cache | ||
| .eslintcache | ||
|
|
||
| # Output of `npm pack` | ||
| *.tgz | ||
|
|
||
| # Output of `wp-scripts plugin-zip` | ||
| *.zip | ||
|
|
||
| # dotenv environment variables file | ||
| .env |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| <?php | ||
| /** | ||
| * Plugin Name: Dev Inspector | ||
| * Description: Example block scaffolded with Create Block tool. | ||
| * Version: 0.1.0 | ||
| * Requires at least: 6.7 | ||
| * Requires PHP: 7.4 | ||
| * Author: The WordPress Contributors | ||
| * License: GPL-2.0-or-later | ||
| * License URI: https://www.gnu.org/licenses/gpl-2.0.html | ||
| * Text Domain: dev-inspector | ||
| * | ||
| * @package DeveloperShowcase | ||
| */ | ||
|
|
||
| if ( ! defined( 'ABSPATH' ) ) { | ||
| exit; // Exit if accessed directly. | ||
| } | ||
| /** | ||
| * Registers the block using a `blocks-manifest.php` file, which improves the performance of block type registration. | ||
| * Behind the scenes, it also registers all assets so they can be enqueued | ||
| * through the block editor in the corresponding context. | ||
| * | ||
| * @see https://make.wordpress.org/core/2025/03/13/more-efficient-block-type-registration-in-6-8/ | ||
| * @see https://make.wordpress.org/core/2024/10/17/new-block-type-registration-apis-to-improve-performance-in-wordpress-6-7/ | ||
| */ | ||
| function developer_showcase_dev_inspector_block_init() { | ||
| /** | ||
| * Registers the block(s) metadata from the `blocks-manifest.php` and registers the block type(s) | ||
| * based on the registered block metadata. | ||
| * Added in WordPress 6.8 to simplify the block metadata registration process added in WordPress 6.7. | ||
| * | ||
| * @see https://make.wordpress.org/core/2025/03/13/more-efficient-block-type-registration-in-6-8/ | ||
| */ | ||
| if ( function_exists( 'wp_register_block_types_from_metadata_collection' ) ) { | ||
| wp_register_block_types_from_metadata_collection( __DIR__ . '/build', __DIR__ . '/build/blocks-manifest.php' ); | ||
| return; | ||
| } | ||
|
|
||
| /** | ||
| * Registers the block(s) metadata from the `blocks-manifest.php` file. | ||
| * Added to WordPress 6.7 to improve the performance of block type registration. | ||
| * | ||
| * @see https://make.wordpress.org/core/2024/10/17/new-block-type-registration-apis-to-improve-performance-in-wordpress-6-7/ | ||
| */ | ||
| if ( function_exists( 'wp_register_block_metadata_collection' ) ) { | ||
| wp_register_block_metadata_collection( __DIR__ . '/build', __DIR__ . '/build/blocks-manifest.php' ); | ||
| } | ||
| /** | ||
| * Registers the block type(s) in the `blocks-manifest.php` file. | ||
| * | ||
| * @see https://developer.wordpress.org/reference/functions/register_block_type/ | ||
| */ | ||
| $manifest_data = require __DIR__ . '/build/blocks-manifest.php'; | ||
| foreach ( array_keys( $manifest_data ) as $block_type ) { | ||
| register_block_type( __DIR__ . "/build/{$block_type}" ); | ||
| } | ||
| } | ||
| add_action( 'init', 'developer_showcase_dev_inspector_block_init' ); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should just assume that we're running 6.8+ and can remove all the extra function_exists checks.