Automattic\WooCommerce\Blocks\BlockTypes

ProductGallery::inject_dialog()protectedWC 1.0

Inject dialog into the product gallery HTML.

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

Хуков нет.

Возвращает

Строку.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->inject_dialog( $gallery_html, $dialog_html );
$gallery_html(строка) (обязательный)
The gallery HTML.
$dialog_html(строка) (обязательный)
The dialog HTML.

Код ProductGallery::inject_dialog() WC 9.8.5

protected function inject_dialog( $gallery_html, $dialog_html ) {

	// Find the position of the last </div>.
	$pos = strrpos( $gallery_html, '</div>' );

	if ( false !== $pos ) {
		// Inject the dialog_html at the correct position.
		$html = substr_replace( $gallery_html, $dialog_html, $pos, 0 );

		return $html;
	}
}