Automattic\WooCommerce\Internal\VariationGallery
ClassicVariationGalleryAdmin::render_hero_image
Render the hero image.
Метод класса: ClassicVariationGalleryAdmin{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
// private - только в коде основоного (родительского) класса $result = $this->render_hero_image( $image_id ): void;
- $image_id(int) (обязательный)
- Attachment ID.
Код ClassicVariationGalleryAdmin::render_hero_image() ClassicVariationGalleryAdmin::render hero image WC 10.9.1
<?php
private function render_hero_image( int $image_id ): void {
$html = wp_get_attachment_image(
$image_id,
'woocommerce_single',
false,
array(
'class' => 'wc-variation-gallery-field__hero-img',
'data-id' => (string) $image_id,
'decoding' => 'async',
'loading' => 'lazy',
)
);
if ( '' === $html ) {
?>
<span class="wc-variation-gallery-field__hero-broken" aria-hidden="true">
<span class="dashicons dashicons-format-image"></span>
</span>
<span class="screen-reader-text">
<?php esc_html_e( 'Attachment file missing', 'woocommerce' ); ?>
</span>
<?php
return;
}
echo wp_kses_post( $html );
}