| 1 |
<?php |
| 2 |
|
| 3 |
namespace LearnPress\Widgets\Course; |
| 4 |
use LearnPress\Widgets\LPWidgetBase; |
| 5 |
|
| 6 |
/** |
| 7 |
* Class AbstractWidget |
| 8 |
* |
| 9 |
* @package LearnPress\Widgets |
| 10 |
* @since 4.2.3.2 |
| 11 |
* @version 1.0.0 |
| 12 |
*/ |
| 13 |
class FilterCourseWidget extends LPWidgetBase { |
| 14 |
public $lp_widget_id = 'course_filter'; |
| 15 |
public $lp_widget_class = 'lp-widget-course-filter'; |
| 16 |
|
| 17 |
public function __construct() { |
| 18 |
$this->lp_widget_name = __( 'LearnPress - Course Filter', 'learnpress' ); |
| 19 |
$this->lp_widget_description = __( 'Widget Course Filter', 'learnpress' ); |
| 20 |
parent::__construct(); |
| 21 |
} |
| 22 |
|
| 23 |
public function widget( $args, $instance ) { |
| 24 |
$title = $instance['title'] ?? ''; |
| 25 |
$content = $instance['content'] ?? ''; |
| 26 |
|
| 27 |
echo $args['before_widget']; |
| 28 |
echo '<h2 class="widget-title">' . $title . '</h2>'; |
| 29 |
echo '<p>' . $content . '</p>'; |
| 30 |
echo $args['after_widget']; |
| 31 |
} |
| 32 |
|
| 33 |
public function form( $instance ) { |
| 34 |
$title = esc_attr( $instance['title'] ?? '' ); |
| 35 |
$content = esc_textarea( $instance['content'] ?? '' ); |
| 36 |
|
| 37 |
?> |
| 38 |
<p> |
| 39 |
<label for="<?php echo $this->get_field_id( 'title' ); ?>">Title:</label> |
| 40 |
<input type="text" name="<?php echo $this->get_field_name( 'title' ); ?>" id="<?php echo $this->get_field_id( 'title' ); ?>" value="<?php echo $title; ?>" class="widefat" /> |
| 41 |
</p> |
| 42 |
<p> |
| 43 |
<label for="<?php echo $this->get_field_id( 'content' ); ?>">Content:</label> |
| 44 |
<textarea name="<?php echo $this->get_field_name( 'content' ); ?>" id="<?php echo $this->get_field_id( 'content' ); ?>" class="widefat"><?php echo $content; ?></textarea> |
| 45 |
</p> |
| 46 |
<?php |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
|