Skip to content
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

Blockbase: Change references to gutenberg_block_template_part, to block_template_part #5031

Merged
merged 2 commits into from
Nov 17, 2021

Conversation

scruffian
Copy link
Member

Changes proposed in this Pull Request:

This function was renamed in WordPress/gutenberg#36201, so we need to update our references to it.

Related issue(s):

@scruffian scruffian requested a review from a team November 15, 2021 12:36
@scruffian scruffian self-assigned this Nov 15, 2021
@jeffikus
Copy link
Contributor

@scruffian can we not move this into an action, where we can check for the presence of the function? That way we can avoid the fatal in future if this changes again.

@scruffian
Copy link
Member Author

I don't see how we could make it an action, but we could create an abstraction around it. I don't think the name will change again though as this is going into core.

@david-binda
Copy link
Contributor

My two cents: The block_template_part function is making it's way to core, and is being backported to Gutenberg 11.9, but is not present in prior versions of Gutenberg, nor in latest WordPress version ( 5.8.2 ).

So, this change would make the theme only work with Gutenberg 11.9.0 at the moment.

So, perhaps a function_exist check, as suggested, might make it fully backward compatible? Eg.:

if ( function_exists( 'block_template_part' ) ) {
    echo block_template_part( 'header' );
} else {
   echo gutenberg_block_template_part( 'header' );
}

The check on whether the original gutenberg_block_template_part function exists is, IMHO, not needed, as the theme works well with older versions of Gutenberg now, so it feels like a good fallback for cases when block_template_part function does not exist yet.

@MaggieCabrera
Copy link
Contributor

I agree with @david-binda here, and also I think this will stop being an issue when we implement #5020 and just simply remove the PHP templates.

I can't seem to reproduce the original issue on a gutenberg-edge sandboxed test site, though

@pbking pbking mentioned this pull request Nov 16, 2021
@scruffian scruffian merged commit 2bd5b5e into trunk Nov 17, 2021
@pbking pbking deleted the rename/gutenberg_block_template_park branch April 12, 2022 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants