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.


Top ↑

Parameters Parameters

$raw

(array) (Required) Raw data array.


Top ↑

Return Return

(int|null) WP_Post ID of the generated course or null on failure.


Top ↑

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;

	}


Top ↑

Changelog 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.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.