learnpress
/
inc
/
ExternalPlugin
/
Elementor
/
Widgets
/
Course
/
Dynamic
/
CourseOfflineAddressDynamicElementor.php
CourseOfflineAddressDynamicElementor.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.3.8, at inc/ExternalPlugin/Elementor/Widgets/Course/Dynamic/CourseOfflineAddressDynamicElementor.php
| 1 | <?php |
| 2 | /** |
| 3 | * Class CourseLevelDynamicElementor |
| 4 | * |
| 5 | * Dynamic course level elementor. |
| 6 | * |
| 7 | * @since 4.2.3.5 |
| 8 | * @version 1.0.1 |
| 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\SingleCourseOfflineTemplate; |
| 16 | use LearnPress\TemplateHooks\Course\SingleCourseTemplate; |
| 17 | use Throwable; |
| 18 | |
| 19 | defined( 'ABSPATH' ) || exit; |
| 20 | |
| 21 | class CourseOfflineAddressDynamicElementor extends Tag { |
| 22 | use LPDynamicElementor; |
| 23 | |
| 24 | public function __construct( array $data = [] ) { |
| 25 | $this->lp_dynamic_title = 'Course Address'; |
| 26 | $this->lp_dynamic_name = 'course-address'; |
| 27 | parent::__construct( $data ); |
| 28 | } |
| 29 | |
| 30 | public function render() { |
| 31 | $singleCourseOfflineTemplate = SingleCourseOfflineTemplate::instance(); |
| 32 | |
| 33 | try { |
| 34 | $course = $this->get_course_model(); |
| 35 | if ( ! $course ) { |
| 36 | return; |
| 37 | } |
| 38 | |
| 39 | $course = CourseModel::find( $course->get_id(), true ); |
| 40 | if ( ! $course ) { |
| 41 | return; |
| 42 | } |
| 43 | |
| 44 | echo $singleCourseOfflineTemplate->html_address( $course ); |
| 45 | } catch ( Throwable $e ) { |
| 46 | error_log( $e->getMessage() ); |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 |