MailPoet\EmailEditor\Engine\Renderer\ContentRenderer
Content_Renderer::set_template_globals()
Set template globals
Method of the class: Content_Renderer{}
No Hooks.
Return
null
. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->set_template_globals( $post, $template );
- $post(WP_Post) (required)
- Post object.
- $template(WP_Block_Template) (required)
- Block template.
Content_Renderer::set_template_globals() Content Renderer::set template globals code WC 9.8.1
private function set_template_globals( WP_Post $post, WP_Block_Template $template ) { global $_wp_current_template_content, $_wp_current_template_id; $_wp_current_template_id = $template->id; $_wp_current_template_content = $template->content; $GLOBALS['post'] = $post; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- I have not found a better way to set the post object for the block renderer. }