Automattic\WooCommerce\Blocks\BlockTypes
ProductGallery::inject_dialog
Inject dialog into the product gallery HTML.
Метод класса: ProductGallery{}
Хуков нет.
Возвращает
string.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->inject_dialog( $gallery_html, $dialog_html );
- $gallery_html(строка) (обязательный)
- The gallery HTML.
- $dialog_html(строка) (обязательный)
- The dialog HTML.
Код ProductGallery::inject_dialog() ProductGallery::inject dialog WC 11.1.0
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;
}