Skip to content

Commit d48bc7c

Browse files
authored
Merge pull request #262 from christiaanstijnen/fix/block-render-callback
pass WP_Block to render callback if available
2 parents 80426f1 + 6835133 commit d48bc7c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Gutenberg/Block_Type.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ public function get_twig_template_path() {
7777
* exists it falls back to the original render callback.
7878
* @param array $attributes Block attributes.
7979
* @param string $content Block content.
80+
* @param \WP_Block|null $block WP Block object
8081
* @return string Rendered block type output.
8182
*/
82-
public function clarkson_render_callback( $attributes, $content ) {
83+
public function clarkson_render_callback( $attributes, $content, $block = null ) {
8384
if ( file_exists( $this->get_twig_template_path() ) ) {
8485
$cc_template = Templates::get_instance();
8586
$this->content_attributes = $attributes;
@@ -118,7 +119,7 @@ public function clarkson_render_callback( $attributes, $content ) {
118119
);
119120
}
120121
if ( is_callable( $this->original_render_callback ) ) {
121-
return (string) call_user_func( $this->original_render_callback, $attributes, $content, $this );
122+
return (string) call_user_func( $this->original_render_callback, $attributes, $content, $block );
122123
}
123124
return $content;
124125
}

0 commit comments

Comments
 (0)