@@ -30,7 +30,7 @@ protected function get_block_type_style() {
3030 * @return string[]
3131 */
3232 protected function get_block_type_uses_context () {
33- return [ 'postId ' , 'hoverZoom ' ];
33+ return [ 'postId ' , 'hoverZoom ' , ' fullScreenOnClick ' ];
3434 }
3535
3636 /**
@@ -41,7 +41,7 @@ protected function get_block_type_uses_context() {
4141 * @param WP_Block $block The block object.
4242 */
4343 protected function enqueue_assets ( array $ attributes , $ content , $ block ) {
44- if ( $ block ->context ['hoverZoom ' ] ) {
44+ if ( $ block ->context ['hoverZoom ' ] || $ block -> context [ ' fullScreenOnClick ' ] ) {
4545 parent ::enqueue_assets ( $ attributes , $ content , $ block );
4646 }
4747 }
@@ -124,6 +124,10 @@ private function get_main_images_html( $context, $product_id ) {
124124
125125 );
126126
127+ if ( $ context ['fullScreenOnClick ' ] ) {
128+ $ attributes ['class ' ] .= ' wc-block-woocommerce-product-gallery-large-image__image--full-screen-on-click ' ;
129+ }
130+
127131 if ( $ context ['hoverZoom ' ] ) {
128132 $ attributes ['class ' ] .= ' wc-block-woocommerce-product-gallery-large-image__image--hoverZoom ' ;
129133 $ attributes ['data-wc-bind--style ' ] = 'selectors.woocommerce.styles ' ;
@@ -147,17 +151,30 @@ private function get_main_images_html( $context, $product_id ) {
147151 }
148152
149153 /**
150- * Get directives for the hover zoom .
154+ * Get directives for the block .
151155 *
152156 * @param array $block_context The block context.
153157 *
154158 * @return array
155159 */
156160 private function get_directives ( $ block_context ) {
161+ return array_merge (
162+ $ this ->get_zoom_directives ( $ block_context ),
163+ $ this ->get_open_dialog_directives ( $ block_context )
164+ );
165+ }
166+
167+ /**
168+ * Get directives for zoom.
169+ *
170+ * @param array $block_context The block context.
171+ *
172+ * @return array
173+ */
174+ private function get_zoom_directives ( $ block_context ) {
157175 if ( ! $ block_context ['hoverZoom ' ] ) {
158176 return array ();
159177 }
160-
161178 $ context = array (
162179 'woocommerce ' => array (
163180 'styles ' => array (
@@ -170,8 +187,24 @@ private function get_directives( $block_context ) {
170187 return array (
171188 'data-wc-on--mousemove ' => 'actions.woocommerce.handleMouseMove ' ,
172189 'data-wc-on--mouseleave ' => 'actions.woocommerce.handleMouseLeave ' ,
173- 'data-wc-on--click ' => 'actions.woocommerce.handleClick ' ,
174190 'data-wc-context ' => wp_json_encode ( $ context , JSON_NUMERIC_CHECK ),
175191 );
176192 }
193+
194+ /**
195+ * Get directives for opening the dialog.
196+ *
197+ * @param array $block_context The block context.
198+ *
199+ * @return array
200+ */
201+ private function get_open_dialog_directives ( $ block_context ) {
202+ if ( ! $ block_context ['fullScreenOnClick ' ] ) {
203+ return array ();
204+ }
205+
206+ return array (
207+ 'data-wc-on--click ' => 'actions.woocommerce.handleClick ' ,
208+ );
209+ }
177210}
0 commit comments