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
Return Return
(string)
Source Source
File: includes/shortcodes/class.llms.shortcode.course.outline.php
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(); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.5.1 | Introduced. |