Add code comment to private method

This commit is contained in:
Sam Seay 2024-08-19 17:37:26 +08:00
parent b88d8e855d
commit fd6cb0edbe
No known key found for this signature in database
GPG Key ID: 2223711A9151668A
1 changed files with 6 additions and 1 deletions

View File

@ -44,6 +44,11 @@ class MiniCartInteractivity extends AbstractBlock {
return $cart;
}
/**
* Get the interactivity namespace attribute.
*
* @return string|false
*/
private function get_interactivity_namespace_attribute() {
return wp_json_encode(
array( 'namespace' => $this->get_full_block_name() ),
@ -77,7 +82,7 @@ class MiniCartInteractivity extends AbstractBlock {
<button class="wc-block-mini-cart__button " data-wc-init="callbacks.initialize" data-wc-context='<?php echo wp_json_encode( $cart_context, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP ); ?>' >
<span class="wc-block-mini-cart__quantity-badge">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="none" width="20" height="20" class="wc-block-mini-cart__icon" aria-hidden="true" focusable="false"><circle cx="12.6667" cy="24.6667" r="2" fill="currentColor"></circle><circle cx="23.3333" cy="24.6667" r="2" fill="currentColor"></circle><path fill-rule="evenodd" clip-rule="evenodd" d="M9.28491 10.0356C9.47481 9.80216 9.75971 9.66667 10.0606 9.66667H25.3333C25.6232 9.66667 25.8989 9.79247 26.0888 10.0115C26.2787 10.2305 26.3643 10.5211 26.3233 10.8081L24.99 20.1414C24.9196 20.6341 24.4977 21 24 21H12C11.5261 21 11.1173 20.6674 11.0209 20.2034L9.08153 10.8701C9.02031 10.5755 9.09501 10.269 9.28491 10.0356ZM11.2898 11.6667L12.8136 19H23.1327L24.1803 11.6667H11.2898Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M5.66669 6.66667C5.66669 6.11438 6.1144 5.66667 6.66669 5.66667H9.33335C9.81664 5.66667 10.2308 6.01229 10.3172 6.48778L11.0445 10.4878C11.1433 11.0312 10.7829 11.5517 10.2395 11.6505C9.69614 11.7493 9.17555 11.3889 9.07676 10.8456L8.49878 7.66667H6.66669C6.1144 7.66667 5.66669 7.21895 5.66669 6.66667Z" fill="currentColor"></path></svg>
<?php // We have to apply a hidden class because of an issue in the way state is resolved when a navigate is performed by the interactivity product button. ?>
<?php // We have to apply a hidden class because of an issue in the way state is resolved when a navigate is performed by the interactivity product button. ?>
<span class="wc-block-mini-cart__badge wc-block-mini-cart__badge__hidden" data-wc-style--display="state.displayQuantityBadgeStyle" data-wc-text="context.cartItemCount">
<?php echo esc_html( $cart_item_count ); ?>
</span>