LLMS_Generator_Courses::generate_course( array $raw )
Generator called for single course imports
Description Description
Converts the single course into a format that can be handled by the bulk courses generator and invokes that generator.
Parameters Parameters
- $raw
-
(array) (Required) Raw data array.
Return Return
(int|null) WP_Post ID of the generated course or null
on failure.
Source Source
File: includes/class-llms-generator-courses.php
public function generate_course( $raw ) { $new_raw = array(); foreach ( array( '_generator', '_version', '_source' ) as $meta ) { if ( isset( $raw[ $meta ] ) ) { $new_raw[ $meta ] = $raw[ $meta ]; unset( $raw[ $meta ] ); } } $new_raw['courses'] = array( $raw ); $courses = $this->generate_courses( $new_raw ); return is_array( $courses ) ? $courses[0] : null; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
4.7.0 | Moved from LLMS_Generator and made public instead of private . Returns an int on success. |
3.3.0 | Introduced. |