| 1 |
<?php |
| 2 |
/** |
| 3 |
* Course Filter Widget. |
| 4 |
* |
| 5 |
* @author ThimPress |
| 6 |
* @category Widgets |
| 7 |
* @package Learnpress/Widgets |
| 8 |
* @version 1.0.0 |
| 9 |
* @since 4.2.3.2 |
| 10 |
*/ |
| 11 |
|
| 12 |
use LearnPress\Helpers\Config; |
| 13 |
|
| 14 |
defined( 'ABSPATH' ) || exit(); |
| 15 |
|
| 16 |
if ( ! class_exists( 'LP_Widget_Course_Filter' ) ) { |
| 17 |
class LP_Widget_Course_Filter extends LP_Widget { |
| 18 |
|
| 19 |
public function __construct() { |
| 20 |
$this->widget_cssclass = 'learnpress widget_course_filter'; |
| 21 |
$this->widget_description = esc_html__( 'Display the Course Filter', 'learnpress' ); |
| 22 |
$this->widget_id = 'learnpress_widget_course_filter'; |
| 23 |
$this->widget_name = esc_html__( 'LearnPress - Course Filter', 'learnpress' ); |
| 24 |
$this->settings = Config::instance()->get( 'filter-course', 'widgets/course' ); |
| 25 |
|
| 26 |
parent::__construct(); |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* Show widget in frontend. |
| 31 |
*/ |
| 32 |
public function lp_rest_api_content( $instance, $params ) { |
| 33 |
$data = array_merge( |
| 34 |
[ 'params_url' => $params['params_url'] ?? lp_archive_skeleton_get_args() ], |
| 35 |
$instance |
| 36 |
); |
| 37 |
|
| 38 |
ob_start(); |
| 39 |
do_action( 'learn-press/filter-courses/layout', $data ); |
| 40 |
return ob_get_clean(); |
| 41 |
} |
| 42 |
} |
| 43 |
} |
| 44 |
|