LLMS_Meta_Box_Lesson::get_fields()
This function is where extending classes can configure all the fields within the metabox The function must return an array which can be consumed by the “output” function
Return Return
(array)
Source Source
File: includes/admin/post-types/meta-boxes/class.llms.meta.box.lesson.php
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | * @ return array */ public function get_fields() { $lesson = llms_get_post( $this ->post ); $methods = array ( 'date' => __( 'On a specific date' , 'lifterlms' ), 'enrollment' => __( 'After course enrollment' , 'lifterlms' ), 'start' => __( 'After course start date' , 'lifterlms' ), ); $section = $lesson ->get_section(); // Tf the lesson isn't first, add previous completion method. if ( 1 !== $lesson ->get( 'order' ) || ( $section && 1 !== $section ->get( 'order' ) ) ) { $methods [ 'prerequisite' ] = __( 'After prerequisite completion' , 'lifterlms' ); } // If the parent course has no start date set, unset the 'start' drip method. $course = $lesson ->get_course(); if ( ! $course || ! $course ->get_date( 'start_date' ) ) { unset( $methods [ 'start' ] ); } return array ( array ( 'title' => __( 'General' , 'lifterlms' ), 'fields' => array ( array ( 'class' => 'code input-full' , 'desc' => sprintf( __( 'Paste the url for a Wistia, Vimeo or Youtube video or a hosted video file. For a full list of supported providers see %s.' , 'lifterlms' ), '<a href="https://wordpress.org/documentation/article/embeds/#list-of-sites-you-can-embed-from" target="_blank">WordPress oEmbeds</a>' ), 'desc_class' => 'd-all' , 'id' => $this ->prefix . 'video_embed' , 'label' => __( 'Video Embed Url' , 'lifterlms' ), 'type' => 'text' , ), array ( 'class' => 'code input-full' , 'desc' => sprintf( __( 'Paste the url for a SoundCloud or Spotify song or a hosted audio file. For a full list of supported providers see %s.' , 'lifterlms' ), '<a href="https://wordpress.org/documentation/article/embeds/#list-of-sites-you-can-embed-from" target="_blank">WordPress oEmbeds</a>' ), 'desc_class' => 'd-all' , 'id' => $this ->prefix . 'audio_embed' , 'type' => 'text' , 'label' => __( 'Audio Embed Url' , 'lifterlms' ), ), array ( 'class' => '' , 'desc' => __( 'Checking this box will allow guests to view the content of this lesson without registering or signing up for the course.' , 'lifterlms' ), 'desc_class' => 'd-3of4 t-3of4 m-1of2' , 'id' => $this ->prefix . 'free_lesson' , 'is_controller' => true, 'label' => __( 'Free Lesson' , 'lifterlms' ), 'type' => 'checkbox' , 'value' => 'yes' , ), ), ), array ( 'title' => __( 'Prerequisites' , 'lifterlms' ), 'fields' => array ( array ( 'class' => '' , 'controls' => '#' . $this ->prefix . 'prerequisite' , 'desc' => __( 'Enable to choose a prerequisite Lesson' , 'lifterlms' ), 'desc_class' => 'd-3of4 t-3of4 m-1of2' , 'id' => $this ->prefix . 'has_prerequisite' , 'label' => __( 'Enable Prerequisite' , 'lifterlms' ), 'type' => 'checkbox' , 'value' => 'yes' , ), array ( 'class' => 'llms-select2-post' , 'data_attributes' => array ( 'allow-clear' => true, 'placeholder' => __( 'Select a Prerequisite Lesson' , 'lifterlms' ), 'post-type' => 'lesson' , ), 'desc' => __( 'Select the prerequisite lesson' , 'lifterlms' ), 'desc_class' => 'd-all' , 'id' => $this ->prefix . 'prerequisite' , 'label' => __( 'Choose Prerequisite' , 'lifterlms' ), 'type' => 'select' , 'value' => llms_make_select2_post_array( array ( get_post_meta( $this ->post->ID, $this ->prefix . 'prerequisite' , true ) ) ), ), ), ), array ( 'title' => __( 'Drip Settings' , 'lifterlms' ), 'fields' => array ( array ( 'class' => 'llms-select2' , 'desc_class' => 'd-all' , 'id' => $this ->prefix . 'drip_method' , 'is_controller' => true, 'label' => __( 'Method' , 'lifterlms' ), 'type' => 'select' , 'value' => $methods , ), array ( 'controller' => '#' . $this ->prefix . 'drip_method' , 'controller_value' => 'lesson,enrollment,start,prerequisite' , 'class' => 'input-full' , 'id' => $this ->prefix . 'days_before_available' , 'label' => __( 'Delay (in days) ' , 'lifterlms' ), 'type' => 'number' , 'step' => 1, 'min' => 0, ), array ( 'controller' => '#' . $this ->prefix . 'drip_method' , 'controller_value' => 'date' , 'class' => 'llms-datepicker' , 'id' => $this ->prefix . 'date_available' , 'label' => __( 'Date Available' , 'lifterlms' ), 'type' => 'date' , ), array ( 'controller' => '#' . $this ->prefix . 'drip_method' , 'controller_value' => 'date' , 'class' => '' , 'desc' => __( 'Optionally enter a time when the lesson should become available. If no time supplied, lesson will be available at 12:00 AM. Format must be HH:MM AM' , 'lifterlms' ), 'id' => $this ->prefix . 'time_available' , 'label' => __( 'Time Available' , 'lifterlms' ), 'type' => 'text' , ), ), ), array ( 'title' => __( 'Quiz' , 'lifterlms' ), 'fields' => array ( array ( 'controller' => '#' . $this ->prefix . 'free_lesson' , 'controller_value' => 'false' , 'desc' => __( 'Checking this box will require students to get a passing score on the above quiz to complete the lesson.' , 'lifterlms' ), 'desc_class' => 'd-3of4 t-3of4 m-1of2' , 'id' => $this ->prefix . 'require_passing_grade' , 'label' => __( 'Require Passing Grade' , 'lifterlms' ), 'type' => 'checkbox' , 'value' => 'yes' , ), ), ), |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.36.2 | 'start' drip method made available only if the parent course has a start date set. |
3.30.3 | Fixed spelling errors. |
3.0.0 | Introduced. |