PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.3.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.3.9
4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 4.2.1 All 138 releases
learnpress / inc / TemplateHooks / CourseBuilder / Question / BuilderQuestionTemplate.php

BuilderQuestionTemplate.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.3.9, at inc/TemplateHooks/CourseBuilder/Question/BuilderQuestionTemplate.php

43 lines 994 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Template hooks Question in Course Builder.
4 *
5 * @since 4.3.6
6 * @version 1.0.0
7 */
8
9 namespace LearnPress\TemplateHooks\CourseBuilder\Question;
10
11 use LearnPress\CourseBuilder\CourseBuilder;
12 use LearnPress\Helpers\Singleton;
13
14 class BuilderQuestionTemplate {
15 use Singleton;
16
17 public function init() {
18 add_action( 'learn-press/course-builder/questions/layout', [ $this, 'layout' ] );
19 }
20
21 public function layout( array $data = [] ) {
22 // Check to switch layout.
23 $item_id = CourseBuilder::get_item_id();
24 $data['item_id'] = $item_id;
25
26 if ( ! empty( $item_id ) ) {
27 // Show edit question
28 BuilderEditQuestionTemplate::instance()->layout( $data );
29 } else {
30 // Show list questions
31 BuilderListQuestionsTemplate::instance()->layout( $data );
32 }
33 }
34
35 public function get_link_edit( $question_id = 0 ) {
36 if ( ! $question_id ) {
37 return '';
38 }
39
40 return CourseBuilder::get_tab_link( 'questions', $question_id );
41 }
42 }
43