Skip to content

v3.0 - blocks-manifest.php, v3.1 - ranking card#255

Merged
jkcox merged 21 commits into
developfrom
jcox-manifest
Jan 14, 2026
Merged

v3.0 - blocks-manifest.php, v3.1 - ranking card#255
jkcox merged 21 commits into
developfrom
jcox-manifest

Conversation

@jkcox
Copy link
Copy Markdown
Contributor

@jkcox jkcox commented Dec 29, 2025

@jkcox jkcox requested a review from Copilot December 29, 2025 20:55
@jkcox jkcox self-assigned this Dec 29, 2025
@jkcox jkcox added [Type] Maintenance Minor file cleanup and organization tasks [Type] Gutenberg Issues/PRs related to the current version of the Gutenberg plugin labels Dec 29, 2025
@jkcox jkcox requested review from wmcconnell and zainabD December 29, 2025 20:56
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes the block registration approach by implementing WordPress 6.7's new performance-optimized block registration API using a manifest file. The change consolidates individual register_block_type() calls into a single wp_register_block_types_from_metadata_collection() call that leverages a pre-generated blocks-manifest.php file.

Key Changes:

  • Updated minimum WordPress requirement from 6.1 to 6.8 and PHP from 7.0 to 7.4
  • Replaced multiple individual block registrations with manifest-based collection registration
  • Added build-blocks-manifest npm script and react-share dependency (v4.4.1)

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.

File Description
unityblocks.php Updated requirements, version to 3.0.0, and replaced individual block registrations with manifest-based approach; commented out Pitchfork theme conditional logic pending new solution
package.json Version bump to 3.0.0, added manifest build script and react-share dependency
package-lock.json Updated version references and removed peer dependency flags for react-share and its dependencies (jsonp)
build/blocks-manifest.php New auto-generated file containing metadata for all 9 blocks (anchor-menu, asu-careers, asu-events, events-grid, hero, image-gallery, news-grid, testimonial, wchm)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread unityblocks.php Outdated
Comment on lines +38 to +45
//$theme_data = wp_get_theme();
//$pitchfork_theme = ('pitchfork' === $theme_data->get('TextDomain') || 'pitchfork' === $theme_data->get('Template'));

// Register these blocks only if not using Pitchfork
// Pitchfork already has these blocks
if (!$pitchfork_theme) {
register_block_type(__DIR__ . '/build/hero');
}
// if (!$pitchfork_theme) {
// register_block_type(__DIR__ . '/build/hero');
// } find new solution that works with block manifest
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is commented out rather than removed, leaving a TODO note about finding a solution for conditional block registration with the manifest approach. Consider either implementing the solution before merging, or creating a tracking issue and removing the commented code. Leaving incomplete functionality commented out can lead to confusion and technical debt.

Copilot uses AI. Check for mistakes.
Comment thread unityblocks.php Outdated
Comment thread build/blocks-manifest.php
'grid'
),
'icon' => 'grid-view',
'description' => 'Dsiplay a grid layout for ASU Events.',
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in the description: "Dsiplay" should be "Display".

Suggested change
'description' => 'Dsiplay a grid layout for ASU Events.',
'description' => 'Display a grid layout for ASU Events.',

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

@wmcconnell wmcconnell Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an obvious typo, but I believe this blocks-manifest.php file is auto-generated, right? In that case, I don't think we'd want to commit this suggested change because wouldn't it just be overwritten the next time the build runs?

I think we need to make this correction in: build/asu-events/block.json instead

Comment thread build/blocks-manifest.php
Comment thread build/blocks-manifest.php
'textdomain' => 'unityblocks',
'viewScript' => array(
'file:./frontend.js',
'unityblocks-careers-view-script'
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The WCHM block is using 'unityblocks-careers-view-script' as its viewScript handle, which appears to be incorrect. It should use a WCHM-specific script handle like 'unityblocks-wchm-view-script' to match the pattern used by other blocks.

Suggested change
'unityblocks-careers-view-script'
'unityblocks-wchm-view-script'

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the above comment about the typo, this is a good catch from CoPilot but I can't tell if the suggestion it would be committing would be in the blocks-manifest.php file, or in the source file where the handle is actually declared: build/wchm/block.json

As always, the caveat is that I may be misunderstanding what Copilot is suggesting it is going to do.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if careers and wchm are on the same page there would likely be issues. this will be a fix in a separate pr as well

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries there, then.

Copy link
Copy Markdown
Contributor

@wmcconnell wmcconnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had no front-end issues adding the blocks to a test page (other than that the Careers block may not be functional, but that's not an issue related to registering the block itself).

I see that this technique requires WordPress 6.8, so I am going to suggest that we keep some backwards compatibility as described on this page (down the page under backwards compatibility) because we still have one high-profile site, Biodesign, running an older version of Wordpress.

The example code on that page looks like this:

if ( function_exists( 'wp_register_block_types_from_metadata_collection' ) ) {
    wp_register_block_types_from_metadata_collection( __DIR__ . '/build', __DIR__ . '/build/blocks-manifest.php' );
} else {
    if ( function_exists( 'wp_register_block_metadata_collection' ) ) {
        wp_register_block_metadata_collection( __DIR__ . '/build', __DIR__ . '/build/blocks-manifest.php' );
    }
    $manifest_data = require __DIR__ . '/build/blocks-manifest.php';
    foreach ( array_keys( $manifest_data ) as $block_type ) {
        register_block_type( __DIR__ . "/build/{$block_type}" );
    }
}

If I understand this code correctly, it will try the latest approach (6.8), before trying to fall back to the previous method (6.7) if possible, before resorting to looping through the folders and registering each block individually. It looks like we would still need the block manifest file for that last loop to work, as it draws the block/folder names from that. Regardless, I would not want to release a new version of this plugin that broke on a site like Biodesign which usually has a lot of eyes on it.

The other solution, of course, is to update Biodesign; it's being held back because of issues we had with displaying profiles due to the old in-house plugin not working on later versions of WordPress. Progress on updating that site has been slow, however.

@wmcconnell
Copy link
Copy Markdown
Contributor

I should say, now that it's too late, that we could always merge this the way it is, since it's only going into develop, and then make the backwards compatibility change. I didn't think of that until after I clicked the button :(

Refactor block registration to support WP version checks and use block manifest.
@jkcox jkcox requested a review from Copilot December 30, 2025 21:51
@jkcox jkcox requested a review from wmcconnell December 30, 2025 21:52
@jkcox jkcox changed the title blocks-manifest.php v3.0 - blocks-manifest.php Dec 30, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread unityblocks.php Outdated
Comment thread unityblocks.php Outdated
Comment thread unityblocks.php Outdated
Comment thread unityblocks.php Outdated
@wmcconnell
Copy link
Copy Markdown
Contributor

@jkcox I did some testing on Wednesday by downgrading my local site to version 6.5.7 (to match Biodesign) and everything worked except the Unity Hero. I go the standard message about my site "not having support" for that block. I see logic in there to skip registering that block if we're using Pitchfork, but I'm certainly not using Pitchfork.

I'm going to run that test again just to make sure I remember things correctly and verify the version/branch information. It was the Wednesday before a holiday and I was not fully paying attention.

Copilot AI and others added 5 commits January 6, 2026 17:50
Co-authored-by: jkcox <8856538+jkcox@users.noreply.github.com>
Co-authored-by: jkcox <8856538+jkcox@users.noreply.github.com>
Co-authored-by: jkcox <8856538+jkcox@users.noreply.github.com>
@wmcconnell
Copy link
Copy Markdown
Contributor

Another long comment on a rainy day:

TL/DR: Unity Heroes will stop working on any site running WordPress 6.5 or earlier. Biodesign is being held on 6.5.7 to allow our old iSearch plugin to continue working. Therefore, updating Unity Blocks on Biodesign may break heroes. And when I say break, they will stop rendering on the front end, and not be editable in the editor. It's only dumb luck that the plugin does not currently automatically update on the Biodesign production site.. This issue is not related to this pull request, but something I discovered while testing. I was concerned about things failing on Biodesign and asked John to apply some code from WordPress to maintain backwards compatibility, but it turns that that code only goes backwards until v6.6 of WordPress. When I rolled my local back to 6.5.7 to match Biodesign, I noticed that heroes stopped working.

Unity Blocks now requires v.6.6, or higher, of WordPress.


First off, so as not to bury the lede, I am planning on approving this pull request. I just wanted to put down for the record what I found in my testing.

First, the history...

  • In WordPress 6.6, a change was made to some associated build tools to allow the use of a better JSX transformer (whatever that is) in React. One of the affected tools was @wordpress/scripts, which I believe we are using in this project
  • However, it is not a backwards-compatible change, and this article points out that to maintain compatibility with WordPress versions before 6.6, you should avoid bumping the version of @wordpress/scripts above v28
  • We, however, have already bumped up our version of @wordpress/scripts to 30, or something like that. This has already happened and is not a part of this pull request, buy the way.
  • Then, in WordPress 6.8, a new method for registering blocks, called the block manifest, was introduced. That is what we are implementing here. As far as I can tell in my testing on 6.6 or higher, the new block manifest approach is working as expected.

This only matters because...

  • One of our high-profile sites, if not our most high-profile, is Biodesign
  • Biodesign is currently being held back on WordPress 6.5.7 in order to keep an old iSearch profile plugin working
  • If we install a plugin that is using a more recent version of the @wordpress/scripts tool, as this plugin is now doing, the Unity Hero block fails to render because it has a specific dependency on something called the react-jsx-runtime that is likely no longer around after we bumped up the version of @wordpress/scripts
  • I tested this by rolling back my local version of WordPress and noticing that all the heroes stopped appearing, and the editor told me I did not have support for that block. Errors in Query Monitor looked like this:
jsx-error
  • By dumb luck, it appears, we have never installed Git Updater on the production Biodesign site, and this plugin never got automatically updated, or all Unity Heroes would stop working.
  • I have talked with Itzel about updating Biodesign; that will break the profiles in the various research centers. We will need to do some outreach and test on QA before we do anything on production.

Copy link
Copy Markdown
Contributor

@wmcconnell wmcconnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we update unityblocks.php to change line 6 to indicate that the new minimum requirement is 6.6. I think that is the case now (see my crazy long comment for more).

@jkcox jkcox requested a review from wmcconnell January 9, 2026 20:37
@jkcox jkcox changed the title v3.0 - blocks-manifest.php v3.0 - blocks-manifest.php, v3.1 - ranking card Jan 9, 2026
wmcconnell
wmcconnell previously approved these changes Jan 9, 2026
Copy link
Copy Markdown
Contributor

@wmcconnell wmcconnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Since the JSX dependency issue I discovered while testing this is not actually tied to this particular PR, and we've bumped the required WordPress version to 6.6, there are no issues.

@jkcox jkcox requested a review from wmcconnell January 14, 2026 17:42
@jkcox
Copy link
Copy Markdown
Contributor Author

jkcox commented Jan 14, 2026

fixed merge conflicts, just need another approval to merge

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Contributor

@wmcconnell wmcconnell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I have it on good authority that this is just resolving merge conflicts. Approved.

@jkcox jkcox merged commit 7fa1fda into develop Jan 14, 2026
6 checks passed
@jkcox jkcox deleted the jcox-manifest branch January 14, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Gutenberg Issues/PRs related to the current version of the Gutenberg plugin [Type] Maintenance Minor file cleanup and organization tasks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants