$attrs Resolved attribute values (unused here). * @return array{screenshots: array} */ protected function viewData( Product $product, array $attrs ): array { unset( $attrs ); return array( 'screenshots' => ScreenshotGallery::fromIds( $product->settings()['screenshots'] ?? array() ), ); } /** * The block is degenerate when the product has no screenshots. * * @param array $data The reduced view data. * @return bool */ protected function viewDataIsEmpty( array $data ): bool { return array() === ( $data['screenshots'] ?? array() ); } /** * Placeholder tiles for the editor. * * @param Product $product The resolved product (unused; the tiles are fixed). * @param array $attrs Resolved attribute values (unused here). * @return array{screenshots: array} */ protected function sampleViewData( Product $product, array $attrs ): array { unset( $product, $attrs ); $tile = static function ( string $label ): array { return array( 'full' => '#', 'thumb' => SamplePreview::placeholderTile( 'releasecart-product-screenshots__img', $label ), 'alt' => $label, 'caption' => $label, ); }; return array( 'screenshots' => array( $tile( __( 'Sample screenshot one', 'releasecart' ) ), $tile( __( 'Sample screenshot two', 'releasecart' ) ), ), ); } }