Automattic\WooCommerce\Blocks\BlockTypes
ProductGallery::inject_dialog
Inject dialog into the product gallery HTML.
Method of the class: ProductGallery{}
No Hooks.
Returns
String.
Usage
// protected - for code of main (parent) or child class $result = $this->inject_dialog( $gallery_html, $dialog_html );
- $gallery_html(string) (required)
- The gallery HTML.
- $dialog_html(string) (required)
- The dialog HTML.
ProductGallery::inject_dialog() ProductGallery::inject dialog code WC 10.8.1
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;
}
return $gallery_html;
}