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

1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
                $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.