-
Notifications
You must be signed in to change notification settings - Fork 147
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
Register all blocks in PHP #2521
Conversation
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.
This is awesome work, good job!
.dev/tests/jest/helpers.js
Outdated
registerBlockType( masonryName, { category: 'common', ...masonrySettings, ...v2Masonry } ); // Register masonry block | ||
registerBlockType( offsetName, { category: 'common', ...offsetSettings, ...v2Offset } ); // Register offset block | ||
registerBlockType( stackedName, { category: 'common', ...stackedSettings, ...v2Stacked } ); // Register stacked block | ||
// const getV2Settings = ( blockMeta, blockSettings ) => { |
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.
If you don't need that code anymore, you can remove it ;)
public function coblocks_enqueue_scripts_for_core_blocks( $block_content, $block ) { | ||
|
||
$block_name = $block['blockName']; | ||
$block_attributes = $block['attrs']; |
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 have a warning on the front page of my website :
Warning: Undefined array key "attrs" in /var/www/html/wp-content/plugins/coblocks/includes/class-coblocks-block-assets.php on line 519
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.
Good call! I've added some bail logic for if the block does not have attributes, or a name defined.
Description
The many changes are a first pass to convert the blocks to register in PHP. The reason for this change has several benefits.
By registering in PHP
lightbox, services-script, counter-script, gist-script, events-script, post-carousel-script, tiny-swiper-sciprs, masonry and animation scripts
. While a number of these scripts had attempted to render 'per-block', in many cases the whole script would render regardless. This change aligns us with core practice in that regard.Screenshots
Types of changes
How has this been tested?
Acceptance criteria
Checklist: