learnpress
/
inc
/
ExternalPlugin
/
Elementor
/
Widgets
/
Course
/
Sections
/
CoursePriceElementor.php
CoursePriceElementor.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.3.8, at inc/ExternalPlugin/Elementor/Widgets/Course/Sections/CoursePriceElementor.php
| 1 | <?php |
| 2 | /** |
| 3 | * Class InstructorTitleElementor |
| 4 | * |
| 5 | * @sicne 4.2.3 |
| 6 | * @version 1.0.0 |
| 7 | */ |
| 8 | |
| 9 | namespace LearnPress\ExternalPlugin\Elementor\Widgets\Course\Sections; |
| 10 | |
| 11 | use LearnPress\ExternalPlugin\Elementor\LPElementorWidgetBase; |
| 12 | use LearnPress\Helpers\Config; |
| 13 | use LearnPress\ExternalPlugin\Elementor\Widgets\Course\SingleCourseBaseElementor; |
| 14 | use LearnPress\TemplateHooks\Course\SingleCourseTemplate; |
| 15 | |
| 16 | class CoursePriceElementor extends LPElementorWidgetBase { |
| 17 | use SingleCourseBaseElementor; |
| 18 | |
| 19 | public function __construct( $data = [], $args = null ) { |
| 20 | $this->title = esc_html__( 'Course Price', 'learnpress' ); |
| 21 | $this->name = 'course_price'; |
| 22 | $this->keywords = [ 'course price', 'price' ]; |
| 23 | parent::__construct( $data, $args ); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Register controls. |
| 28 | * |
| 29 | * @return void |
| 30 | */ |
| 31 | protected function register_controls() { |
| 32 | $this->controls = Config::instance()->get( |
| 33 | 'course-price', |
| 34 | 'elementor/course' |
| 35 | ); |
| 36 | parent::register_controls(); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Show content of widget |
| 41 | * |
| 42 | * @return void |
| 43 | */ |
| 44 | protected function render() { |
| 45 | $singleCourseTemplate = SingleCourseTemplate::instance(); |
| 46 | |
| 47 | try { |
| 48 | $course = $this->get_course_model(); |
| 49 | if ( ! $course ) { |
| 50 | return; |
| 51 | } |
| 52 | echo $singleCourseTemplate->html_price( $course ); |
| 53 | } catch ( \Throwable $e ) { |
| 54 | error_log( $e->getMessage() ); |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 |