LLMS_Settings_Courses
Admin Settings Page “Courses” Tab class
Source Source
File: includes/admin/settings/class.llms.settings.courses.php
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 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 | class LLMS_Settings_Courses extends LLMS_Settings_Page { /** * Constructor * * Executes settings tab actions. * * @since 3.5.0 * * @return void */ public function __construct() { $this ->id = 'courses' ; $this ->label = __( 'Courses' , 'lifterlms' ); add_filter( 'lifterlms_settings_tabs_array' , array ( $this , 'add_settings_page' ), 20 ); add_action( 'lifterlms_settings_' . $this ->id, array ( $this , 'output' ) ); add_action( 'lifterlms_settings_save_' . $this ->id, array ( $this , 'save' ) ); } /** * Get settings array. * * @since 3.5.0 * @since 7.5.0 Added settings for enabling/disabling favorites. * * @return array */ public function get_settings() { /** * Filter the course settings. * * @since 3.5.0 * * @param array $course_settings THe course Settings. */ $course = apply_filters( 'lifterlms_course_settings' , array ( array ( 'class' => 'top' , 'id' => 'course_general_options' , 'type' => 'sectionstart' , ), array ( 'id' => 'course_general_options_title' , 'title' => __( 'Course Settings' , 'lifterlms' ), 'type' => 'title' , ), array ( 'desc' => __( 'Enabling this setting allows students to mark a lesson as "incomplete" after they have completed a lesson.' , 'lifterlms' ), 'default' => 'no' , 'id' => 'lifterlms_retake_lessons' , 'title' => __( 'Retake Lessons' , 'lifterlms' ), 'type' => 'checkbox' , ), array ( 'title' => __( 'Lesson Favorites' , 'lifterlms' ), 'desc' => __( 'Enabling this setting allows students to mark a lesson as "favorite".' , 'lifterlms' ), 'id' => 'lifterlms_favorites' , 'default' => 'yes' , 'type' => 'checkbox' , ), array ( 'type' => 'sectionend' , 'id' => 'course_general_options' , ), array ( 'class' => 'top' , 'id' => 'course_archive_options' , 'type' => 'sectionstart' , ), array ( 'id' => 'course_options' , 'title' => __( 'Course Catalog Settings' , 'lifterlms' ), 'type' => 'title' , ), array ( 'class' => 'llms-select2-post' , 'custom_attributes' => array ( 'data-allow-clear' => true, 'data-post-type' => 'page' , 'data-placeholder' => __( 'Select a page' , 'lifterlms' ), ), 'desc' => sprintf( __( 'This page is where your visitors will find a list of all your available courses. %1$sMore Information%2$s' , 'lifterlms' ), '<a href="https://lifterlms.com/docs/course-catalog/" target="_blank">' , '</a>' ), 'id' => 'lifterlms_shop_page_id' , 'options' => llms_make_select2_post_array( get_option( 'lifterlms_shop_page_id' , '' ) ), 'title' => __( 'Course Catalog' , 'lifterlms' ), 'type' => 'select' , ), array ( 'default' => 9, 'desc' => __( 'To show all courses on one page, enter -1.' , 'lifterlms' ), 'id' => 'lifterlms_shop_courses_per_page' , 'title' => __( 'Courses per page' , 'lifterlms' ), 'type' => 'number' , ), array ( 'default' => 'menu_order' , 'desc' => __( 'Determines the display order for courses on the courses page.' , 'lifterlms' ), 'id' => 'lifterlms_shop_ordering' , 'options' => array ( 'menu_order,ASC' => __( 'Order (Low to High)' , 'lifterlms' ), 'title,ASC' => __( 'Title (A - Z)' , 'lifterlms' ), 'title,DESC' => __( 'Title (Z - A)' , 'lifterlms' ), 'date,DESC' => __( 'Most Recent' , 'lifterlms' ), ), 'title' => __( 'Catalog Sorting' , 'lifterlms' ), 'type' => 'select' , ), array ( 'type' => 'sectionend' , 'id' => 'course_archive_options' , ), ) ); /** * Ensure deprecated filter sticks around for a while * * @todo deprecate this filter */ $deprecated = apply_filters( 'lifterlms_catalog_settings' , array () ); return array_merge ( $course , $deprecated ); } /** * Save settings * * @since 3.5.0 * * @return void */ public function save() { $settings = $this ->get_settings(); |
Expand full source code Collapse full source code View on GitHub
Methods Methods
- __construct — Constructor
- get_settings — Get settings array
- output — Output settings on screen
- save — Save settings
Changelog Changelog
Version | Description |
---|---|
3.5.0 | Introduced. |