Automattic\WooCommerce\Blocks\AIContent
ContentProcessor::verify_images()
Ensure that images are provided for assignment to products and patterns.
Method of the class: ContentProcessor{}
No Hooks.
Return
Array|Int|Mixed|String|WP_Error
.
Usage
$result = ContentProcessor::verify_images( $images, $ai_connection, $token, $business_description );
- $images(array|WP_Error) (required)
- The array of images.
- $ai_connection(Connection) (required)
- The AI connection.
- $token(string) (required)
- The JWT token.
- $business_description(string) (required)
- The business description.
ContentProcessor::verify_images() ContentProcessor::verify images code WC 9.8.1
public static function verify_images( $images, $ai_connection, $token, $business_description ) { if ( ! is_wp_error( $images ) && ! empty( $images['images'] ) && ! empty( $images['search_term'] ) ) { return $images; } $images = ( new Pexels() )->get_images( $ai_connection, $token, $business_description ); if ( is_wp_error( $images ) ) { return $images; } if ( empty( $images['images'] ) || empty( $images['search_term'] ) ) { return new WP_Error( 'images_not_found', __( 'No images provided for generating AI content.', 'woocommerce' ) ); } return $images; }