Automattic\WooCommerce\Blocks\Templates

AbstractTemplateCompatibility::get_hooks_buffer()protectedWC 1.0

Get the buffer content of the hooks to append/prepend to render content.

Method of the class: AbstractTemplateCompatibility{}

Hooks from the method

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_hooks_buffer( $hooks, $position );
$hooks(array) (required)
The hooks to be rendered.
$position(string) (required)
The position of the hooks.

AbstractTemplateCompatibility::get_hooks_buffer() code WC 9.6.0

protected function get_hooks_buffer( $hooks, $position ) {
	ob_start();
	foreach ( $hooks as $hook => $data ) {
		if ( $data['position'] === $position ) {
			/**
			 * Action to render the content of a hook.
			 *
			 * @since 9.5.0
			 */
			do_action( $hook );
		}
	}
	return ob_get_clean();
}