Join GitHub today
Add function_exists() check to block PHP template #147
Check for the existance of the function register_block_type() in the PHP
Since Gutenberg has not yet been merged into core, currently the function
Reading through the existing Behat tests for blocks, it looks like checks for specific lines of code are only being done on lines that are dynamic (i.e. there is a placeholder that gets replaced). Based on this, I have not added any tests for this change.
If I've misunderstood things, please let me know and I'd be happy to update this PR.
No, I think there's no need to add a test for this.
However, given that this is not usual practice, and that the scaffolding tools often serve an educational purpose as well, I'd prefer to have a comment before the
function_exists(), along the lines of:
// Skip block registration in case Gutenberg is not enabled/merged.