| 1 |
<?php |
| 2 |
|
| 3 |
namespace LearnPress\Gutenberg\Blocks\Legacy; |
| 4 |
|
| 5 |
use LearnPress\Gutenberg\Blocks\AbstractBlockType; |
| 6 |
use LearnPress\Helpers\Template; |
| 7 |
use LearnPress\Models\CourseModel; |
| 8 |
use LP_Settings; |
| 9 |
|
| 10 |
/** |
| 11 |
* Class ArchiveCourseBlockLegacy |
| 12 |
* |
| 13 |
* Handle register, render block template |
| 14 |
*/ |
| 15 |
class ArchiveCourseBlockLegacy extends AbstractBlockType { |
| 16 |
public $block_name = 'archive-course-legacy'; |
| 17 |
/*public $display_on_templates = [ |
| 18 |
'learnpress/learnpress//archive-lp_course', |
| 19 |
'learnpress/learnpress//taxonomy-course_tag', |
| 20 |
'learnpress/learnpress//taxonomy-course_category', |
| 21 |
];*/ |
| 22 |
|
| 23 |
/** |
| 24 |
* Render content of block tag |
| 25 |
* |
| 26 |
* @param array $attributes | Attributes of block tag. |
| 27 |
* |
| 28 |
* @return false|string |
| 29 |
*/ |
| 30 |
public function render_content_block_template( array $attributes, $content, $block ): string { |
| 31 |
wp_enqueue_style( 'learnpress' ); |
| 32 |
$page_template = 'archive-course.php'; |
| 33 |
|
| 34 |
ob_start(); |
| 35 |
Template::instance()->get_frontend_template( $page_template, compact( 'attributes' ) ); |
| 36 |
$html = ob_get_clean(); |
| 37 |
|
| 38 |
return $html; |
| 39 |
} |
| 40 |
} |
| 41 |
|