diff --git a/src/BlockTypes/AbstractBlock.php b/src/BlockTypes/AbstractBlock.php index 31f51201445..2ed75497878 100644 --- a/src/BlockTypes/AbstractBlock.php +++ b/src/BlockTypes/AbstractBlock.php @@ -37,8 +37,13 @@ abstract class AbstractBlock { /** * Constructor + * + * @param string $block_name Optional set block name during construct. */ - public function __construct() { + public function __construct( $block_name = '' ) { + if ( $block_name ) { + $this->block_name = $block_name; + } add_action( 'enqueue_block_editor_assets', [ $this, 'enqueue_editor_assets' ] ); } @@ -102,7 +107,7 @@ public function enqueue_editor_assets() { * @return string Rendered block with data attributes. */ protected function inject_html_data_attributes( $content, array $attributes ) { - return preg_replace( '/