PUM_Admin_BlockEditor::add_attributes_to_registered_blocks()

This is needed to resolve an issue with blocks that use the ServerSideRender component. Registering the attributes only in js can cause an error message to appear. Registering the attributes in PHP as well, seems to resolve the issue. Ideally, this bug will be fixed in the future.


Description Description

Reference: https://github.com/WordPress/gutenberg/issues/16850


Source Source

File: classes/Admin/BlockEditor.php

	public static function add_attributes_to_registered_blocks() {
		global $wp_version;

		if ( version_compare( $wp_version, '5.0' ) === -1 ) {
			return;
		}

		$registered_blocks = WP_Block_Type_Registry::get_instance()->get_all_registered();

		foreach ( $registered_blocks as $block ) {
			$block->attributes['openPopupId'] = [
				'type'    => 'string',
				'default' => '',
			];
		}
	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.16.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.