Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

LLMS_Admin_Builder::update_section( array $section_data, LLMS_Course $course_id )

Update a section with data from the heartbeat


Parameters Parameters

$section_data

(array) (Required) Array of section data.

$course_id

(LLMS_Course) (Required) Instance of the parent LLMS_Course.


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/admin/class.llms.admin.builder.php

					$quiz->set( $prop, $quiz_data[ $prop ] );
				}
			}

			if ( isset( $quiz_data['questions'] ) && is_array( $quiz_data['questions'] ) ) {
				$res['questions'] = self::update_questions( $quiz_data['questions'], $quiz );
			}

			// Update all custom fields.
			self::update_custom_schemas( 'quiz', $quiz, $quiz_data );

		}

		return $res;

	}

	/**
	 * Update a section with data from the heartbeat
	 *
	 * @since 3.16.0
	 * @since 3.16.11 Unknown.
	 *
	 * @param array       $section_data Array of section data.
	 * @param LLMS_Course $course_id    Instance of the parent LLMS_Course.
	 * @return array
	 */
	private static function update_section( $section_data, $course_id ) {

		$res = array_merge(
			$section_data,
			array(
				'orig_id' => $section_data['id'],
			)
		);

		// Create a new section.
		if ( self::is_temp_id( $section_data['id'] ) ) {

			$section = new LLMS_Section( 'new' );
			$section->set( 'parent_course', $course_id );

			// Update existing section.
		} else {

			$section = llms_get_post( $section_data['id'] );

		}

		// We don't have a proper section to work with...
		if ( empty( $section ) || ! is_a( $section, 'LLMS_Section' ) ) {
			// Translators: %s = Section post id.


Top ↑

Changelog Changelog

Changelog
Version Description
3.16.11 Unknown.
3.16.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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