LLMS_Shortcode_Course_Outline::get_output()

Retrieve the actual content of the shortcode


Description Description

$atts & $content are both filtered before being passed to get_output() output is filtered so the return of get_output() doesn’t need its own filter


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/shortcodes/class.llms.shortcode.course.outline.php

91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
protected function get_output() {
 
    $course  = new LLMS_Course( $this->get_attribute( 'course_id' ) );
    $student = llms_get_student();
 
    $args = array(
        'collapse'        => $this->get_attribute( 'collapse' ),
        'course'          => $course,
        'current_section' => null,
        'current_lesson'  => null,
        'sections'        => array(),
        'student'         => $student,
        'toggles'         => $this->get_attribute( 'toggles' ),
    );
 
    if ( ! $course ) {
        return '';
    }
 
    $next_lesson = $student ? llms_get_post( $student->get_next_lesson( $course->get( 'id' ) ) ) : false;
 
    if ( 'lesson' === get_post_type() ) {
        $args['current_lesson'] = get_the_ID();
    }
 
    // show only the current section
    if ( $next_lesson && 'current_section' === $this->get_attribute( 'outline_type' ) ) {
 
        $section = llms_get_post( $next_lesson->get( 'parent_section' ) );
 
        $args['sections'][]      = $section;
        $args['current_section'] = $section->get( 'id' );
 
    } else {
 
        if ( 'lesson' === get_post_type() ) {
            $lesson = llms_get_post( get_the_ID() );
        } else {
            $lesson = $next_lesson;
        }
 
        $args['sections']        = $course->get_sections();
        $args['current_section'] = ! empty( $lesson ) && is_a( $lesson, 'LLMS_Post_Model' ) ? $lesson->get( 'parent_section' ) : false;
 
    }
 
    ob_start();
    llms_get_template( 'course/outline-list-small.php', $args );
    return ob_get_clean();
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
3.5.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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