Automattic\WooCommerce\Blocks\BlockTypes

ProductGalleryThumbnails::inject_view_all()protectedWC 1.0

Inject View All markup into the product thumbnail HTML.

Method of the class: ProductGalleryThumbnails{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->inject_view_all( $thumbnail_html, $view_all_html );
$thumbnail_html(string) (required)
The thumbnail HTML.
$view_all_html(string) (required)
The view all HTML.

ProductGalleryThumbnails::inject_view_all() code WC 9.8.1

protected function inject_view_all( $thumbnail_html, $view_all_html ) {

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

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

		return $html;
	}

	return $thumbnail_html;
}