| 1 |
<?php |
| 2 |
/** |
| 3 |
* Skin Loop Item for Widget Courses |
| 4 |
* Call list item on plugin Thim Elementor Kit. |
| 5 |
* |
| 6 |
* @since 4.2.5.7 |
| 7 |
* @version 1.0.0 |
| 8 |
*/ |
| 9 |
namespace LearnPress\ExternalPlugin\Elementor\Widgets\Course\Skins; |
| 10 |
|
| 11 |
use Elementor\Plugin; |
| 12 |
use Elementor\Widget_Base; |
| 13 |
use LearnPress\Helpers\Config; |
| 14 |
use LP_Course; |
| 15 |
|
| 16 |
class CoursesLoopItem extends SkinCoursesBase { |
| 17 |
public $lp_el_skin_id = 'courses_loop_item'; |
| 18 |
public $lp_el_skin_title = 'Courses Loop Item'; |
| 19 |
|
| 20 |
public function controls_on_section_skin( Widget_Base $widget, $args ) { |
| 21 |
// Only load on the Admin |
| 22 |
if ( ! is_admin() ) { |
| 23 |
return; |
| 24 |
} |
| 25 |
|
| 26 |
$this->parent = $widget; |
| 27 |
|
| 28 |
Config::instance()->get( |
| 29 |
'courses-loop-item', |
| 30 |
'elementor/course/skin', |
| 31 |
[ 'CoursesLoopItem' => $this ] |
| 32 |
); |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* Render single item course |
| 37 |
* |
| 38 |
* @param LP_Course $course |
| 39 |
* @param array $settings |
| 40 |
* |
| 41 |
* @return string |
| 42 |
*/ |
| 43 |
public static function render_course( LP_Course $course, array $settings = [] ): string { |
| 44 |
global $post; |
| 45 |
$post = get_post( $course->get_id() ); |
| 46 |
$id = $settings['lp_el_skin_courses_loop_item_template_id'] ?? 0; |
| 47 |
|
| 48 |
return Plugin::instance()->frontend->get_builder_content( $id ); |
| 49 |
} |
| 50 |
} |
| 51 |
|