Skip to content

Commit

Permalink
Merge pull request #262 from christiaanstijnen/fix/block-render-callback
Browse files Browse the repository at this point in the history
pass WP_Block to render callback if available
  • Loading branch information
menno-ll authored Nov 9, 2023
2 parents 80426f1 + 6835133 commit d48bc7c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Gutenberg/Block_Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ public function get_twig_template_path() {
* exists it falls back to the original render callback.
* @param array $attributes Block attributes.
* @param string $content Block content.
* @param \WP_Block|null $block WP Block object
* @return string Rendered block type output.
*/
public function clarkson_render_callback( $attributes, $content ) {
public function clarkson_render_callback( $attributes, $content, $block = null ) {
if ( file_exists( $this->get_twig_template_path() ) ) {
$cc_template = Templates::get_instance();
$this->content_attributes = $attributes;
Expand Down Expand Up @@ -118,7 +119,7 @@ public function clarkson_render_callback( $attributes, $content ) {
);
}
if ( is_callable( $this->original_render_callback ) ) {
return (string) call_user_func( $this->original_render_callback, $attributes, $content, $this );
return (string) call_user_func( $this->original_render_callback, $attributes, $content, $block );
}
return $content;
}
Expand Down

0 comments on commit d48bc7c

Please sign in to comment.