LLMS_Generator_Courses::maybe_sideload_choice_image( array $choice, int $question_id )
Determines if a raw question choice object contains image data that should be sideloaded
Parameters Parameters
- $choice
-
(array) (Required) Raw choice data array.
- $question_id
-
(int) (Required) WP_Post ID of the parent question.
Return Return
(array) Choice data array.
Source Source
File: includes/class-llms-generator-courses.php
protected function maybe_sideload_choice_image( $choice, $question_id ) { if ( empty( $choice['choice_type'] ) || 'image' !== $choice['choice_type'] || ! $this->is_image_sideloading_enabled() ) { return $choice; } $id = $this->sideload_image( $question_id, $choice['choice']['src'], 'id' ); if ( is_wp_error( $id ) ) { return $choice; } $choice['choice']['id'] = $id; $choice['choice']['src'] = wp_get_attachment_url( $id ); return $choice; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
4.7.0 | Introduced. |