BP_REST_Learndash_Courses_Endpoint::get_item_schema()

Get the forums schema, conforming to JSON Schema.

Description

Return

(array)

Source

File: bp-integrations/learndash/classes/class-bp-rest-learndash-courses-endpoint.php

356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
public function get_item_schema() {
    $schema = array(
        '$schema'    => 'http://json-schema.org/draft-04/schema#',
        'title'      => 'learndash_courses',
        'type'       => 'object',
        'properties' => array(
            'id'             => array(
                'description' => __( 'Unique identifier for the course.', 'buddyboss' ),
                'type'        => 'integer',
                'context'     => array( 'embed', 'view', 'edit' ),
                'readonly'    => true,
            ),
            'date'           => array(
                'description' => __( 'The date the object was published, in the site\'s timezone.', 'buddyboss' ),
                'type'        => 'string',
                'format'      => 'date-time',
                'context'     => array( 'embed', 'view', 'edit' ),
            ),
            'date_gmt'       => array(
                'description' => __( 'The date the object was published, as GMT.', 'buddyboss' ),
                'type'        => 'string',
                'format'      => 'date-time',
                'context'     => array( 'embed', 'view', 'edit' ),
            ),
            'guid'           => array(
                'description' => __( 'The url identifier for the course.', 'buddyboss' ),
                'type'        => 'object',
                'context'     => array( 'embed', 'view', 'edit' ),
                'readonly'    => true,
                'properties'  => array(
                    'raw'      => array(
                        'description' => __( 'GUID for the course, as it exists in the database.', 'buddyboss' ),
                        'type'        => 'string',
                        'context'     => array( 'embed', 'view', 'edit' ),
                    ),
                    'rendered' => array(
                        'description' => __( 'GUID for the course, transformed for display.', 'buddyboss' ),
                        'type'        => 'string',
                        'context'     => array( 'embed', 'view', 'edit' ),
                    ),
                ),
            ),
            'modified'       => array(
                'description' => __( 'The date for course was last modified, in the site\'s timezone.', 'buddyboss' ),
                'type'        => 'string',
                'format'      => 'date-time',
                'context'     => array( 'embed', 'view', 'edit' ),
                'readonly'    => true,
            ),
            'modified_gmt'   => array(
                'description' => __( 'The date for course was last modified, as GMT.', 'buddyboss' ),
                'type'        => 'string',
                'format'      => 'date-time',
                'context'     => array( 'embed', 'view', 'edit' ),
                'readonly'    => true,
            ),
            'slug'           => array(
                'description' => __( 'An alphanumeric unique identifier for the course.', 'buddyboss' ),
                'type'        => 'string',
                'context'     => array( 'embed', 'view', 'edit' ),
                'arg_options' => array(
                    'sanitize_callback' => 'sanitize_title',
                ),
            ),
            'status'         => array(
                'description' => __( 'The current status of the course.', 'buddyboss' ),
                'type'        => 'string',
                'context'     => array( 'embed', 'view', 'edit' ),
            ),
            'type'           => array(
                'description' => __( 'Post type slug.', 'buddyboss' ),
                'type'        => 'string',
                'context'     => array( 'embed', 'view', 'edit' ),
            ),
            'author'         => array(
                'description' => __( 'The ID for the author of the course.', 'buddyboss' ),
                'type'        => 'integer',
                'context'     => array( 'embed', 'view', 'edit' ),
            ),
            'menu_order'     => array(
                'description' => __( 'Order number of the course.', 'buddyboss' ),
                'type'        => 'integer',
                'context'     => array( 'embed', 'view', 'edit' ),
            ),
            'featured_media' => array(
                'description' => __( 'The featured media for the course.', 'buddyboss' ),
                'type'        => 'object',
                'context'     => array( 'embed', 'view', 'edit' ),
                'properties'  => array(
                    'large'  => array(
                        'description' => __( 'Large size featured media for the course', 'buddyboss' ),
                        'type'        => 'string',
                        'context'     => array( 'embed', 'view', 'edit' ),
                    ),
                    'medium' => array(
                        'description' => __( 'Medium size featured media for the course', 'buddyboss' ),
                        'type'        => 'string',
                        'context'     => array( 'embed', 'view', 'edit' ),
                    ),
                    'thumb'  => array(
                        'description' => __( 'Thumbnail size featured media for the course', 'buddyboss' ),
                        'type'        => 'string',
                        'context'     => array( 'embed', 'view', 'edit' ),
                    ),
                ),
            ),
            'lessons_count'  => array(
                'description' => __( 'Lessons count for the course.', 'buddyboss' ),
                'type'        => 'integer',
                'context'     => array( 'embed', 'view', 'edit' ),
            ),
            'has_access'     => array(
                'description' => __( 'Whether the current user has access for the course or not.', 'buddyboss' ),
                'type'        => 'boolean',
                'context'     => array( 'embed', 'view', 'edit' ),
            ),
            'purchasable'    => array(
                'description' => __( 'Whether the course is purchasable or not.', 'buddyboss' ),
                'type'        => 'boolean',
                'context'     => array( 'embed', 'view', 'edit' ),
            ),
            'status_bubble'  => array(
                'description' => __( 'Course bubble strip text.', 'buddyboss' ),
                'type'        => 'string',
                'context'     => array( 'embed', 'view', 'edit' ),
            ),
            'progress'       => array(
                'description' => __( 'Course progress status.', 'buddyboss' ),
                'type'        => 'object',
                'context'     => array( 'embed', 'view', 'edit' ),
                'properties'  => array(
                    'percentage' => array(
                        'description' => __( 'Completed course in percentage.', 'buddyboss' ),
                        'type'        => 'string',
                        'context'     => array( 'embed', 'view', 'edit' ),
                    ),
                    'completed'  => array(
                        'description' => __( 'Completed steps for the course.', 'buddyboss' ),
                        'type'        => 'string',
                        'context'     => array( 'embed', 'view', 'edit' ),
                    ),
                    'total'      => array(
                        'description' => __( 'Total steps count for the course.', 'buddyboss' ),
                        'type'        => 'string',
                        'context'     => array( 'embed', 'view', 'edit' ),
                    ),
                ),
            ),
            'last_activity'  => array(
                'description' => __( 'Last activity for the course.', 'buddyboss' ),
                'type'        => 'string',
                'context'     => array( 'embed', 'view', 'edit' ),
            ),
            'title'          => array(
                'description' => __( 'The title of the course.', 'buddyboss' ),
                'context'     => array( 'embed', 'view', 'edit' ),
                'type'        => 'object',
                'properties'  => array(
                    'raw'      => array(
                        'description' => __( 'Content for the title of the course, as it exists in the database.', 'buddyboss' ),
                        'type'        => 'string',
                        'context'     => array( 'embed', 'view', 'edit' ),
                    ),
                    'rendered' => array(
                        'description' => __( 'The title of the course, transformed for display.', 'buddyboss' ),
                        'type'        => 'string',
                        'context'     => array( 'embed', 'view', 'edit' ),
                    ),
                ),
            ),
            'excerpt'        => array(
                'description' => __( 'Short Content of the course.', 'buddyboss' ),
                'type'        => 'string',
                'context'     => array( 'embed', 'view', 'edit' ),
            ),
            'content'        => array(
                'context'     => array( 'embed', 'view', 'edit' ),
                'description' => __( 'The content of the course.', 'buddyboss' ),
                'type'        => 'object',
                'properties'  => array(
                    'raw'      => array(
                        'description' => __( 'Content for the course, as it exists in the database.', 'buddyboss' ),
                        'type'        => 'string',
                        'context'     => array( 'embed', 'view', 'edit' ),
                    ),
                    'rendered' => array(
                        'description' => __( 'HTML content for the course, transformed for display.', 'buddyboss' ),
                        'type'        => 'string',
                        'context'     => array( 'embed', 'view', 'edit' ),
                    ),
                ),
            ),
        ),
    );
 
    /**
     * Filters the course schema.
     *
     * @param string $schema The endpoint schema.
     */
    return apply_filters( 'bp_rest_learndash_course_schema', $this->add_additional_fields_schema( $schema ) );
}

Changelog

Changelog
Version Description
0.1.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.