Automattic\WooCommerce\Blocks\Templates

AbstractTemplateCompatibility::get_hooks_buffer()protectedWC 1.0

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

Метод класса: AbstractTemplateCompatibility{}

Хуки из метода

Возвращает

Строку.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_hooks_buffer( $hooks, $position );
$hooks(массив) (обязательный)
The hooks to be rendered.
$position(строка) (обязательный)
The position of the hooks.

Код AbstractTemplateCompatibility::get_hooks_buffer() WC 8.7.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();
}