learnpress
/
inc
/
ExternalPlugin
/
Elementor
/
Widgets
/
Course
/
Dynamic
/
CourseCapacityDynamicElementor.php
CourseCapacityDynamicElementor.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.3.8, at inc/ExternalPlugin/Elementor/Widgets/Course/Dynamic/CourseCapacityDynamicElementor.php
| 1 | <?php |
| 2 | /** |
| 3 | * Class CourseLevelDynamicElementor |
| 4 | * |
| 5 | * Dynamic course level elementor. |
| 6 | * |
| 7 | * @since 4.2.3.5 |
| 8 | * @version 1.0.0 |
| 9 | */ |
| 10 | |
| 11 | namespace LearnPress\ExternalPlugin\Elementor\Widgets\Course\Dynamic; |
| 12 | use Elementor\Core\DynamicTags\Tag; |
| 13 | use LearnPress\ExternalPlugin\Elementor\LPDynamicElementor; |
| 14 | use LearnPress\Models\CourseModel; |
| 15 | use LearnPress\TemplateHooks\Course\SingleCourseTemplate; |
| 16 | use Throwable; |
| 17 | |
| 18 | defined( 'ABSPATH' ) || exit; |
| 19 | |
| 20 | class CourseCapacityDynamicElementor extends Tag { |
| 21 | use LPDynamicElementor; |
| 22 | |
| 23 | public function __construct( array $data = [] ) { |
| 24 | $this->lp_dynamic_title = 'Course Capacity'; |
| 25 | $this->lp_dynamic_name = 'course-capacity'; |
| 26 | parent::__construct( $data ); |
| 27 | } |
| 28 | |
| 29 | public function render() { |
| 30 | $singleCourseTemplate = SingleCourseTemplate::instance(); |
| 31 | |
| 32 | try { |
| 33 | $course = $this->get_course_model(); |
| 34 | if ( ! $course ) { |
| 35 | return; |
| 36 | } |
| 37 | |
| 38 | echo $singleCourseTemplate->html_capacity( $course ); |
| 39 | } catch ( Throwable $e ) { |
| 40 | error_log( $e->getMessage() ); |
| 41 | } |
| 42 | } |
| 43 | } |
| 44 |