| 1 |
<?php |
| 2 |
|
| 3 |
namespace learnpress\inc\TemplateHooks\Admin\AI; |
| 4 |
|
| 5 |
use LearnPress\Helpers\Singleton; |
| 6 |
use LearnPress\Helpers\Template; |
| 7 |
|
| 8 |
/** |
| 9 |
* Class AdminCreateCourseAITemplate |
| 10 |
* |
| 11 |
* @since 4.3.0 |
| 12 |
* @version 1.0.1 |
| 13 |
*/ |
| 14 |
class AdminAICloseWarningTemplate { |
| 15 |
use Singleton; |
| 16 |
|
| 17 |
/** |
| 18 |
* @var array|null |
| 19 |
*/ |
| 20 |
private ?array $config; |
| 21 |
|
| 22 |
/** |
| 23 |
* Init hooks. |
| 24 |
*/ |
| 25 |
public function init() { |
| 26 |
add_action( 'admin_footer', [ $this, 'layout_popup' ] ); |
| 27 |
} |
| 28 |
|
| 29 |
public function layout_popup() { |
| 30 |
$screen = get_current_screen(); |
| 31 |
if ( ! $screen || $screen->id != 'edit-' . LP_COURSE_CPT ) { |
| 32 |
return; |
| 33 |
} |
| 34 |
|
| 35 |
echo $this->template(); |
| 36 |
} |
| 37 |
|
| 38 |
public function template(): string { |
| 39 |
$components = [ |
| 40 |
'wrap-script-template' => '<script type="text/template" id="lp-tmpl-close-warning-ai">', |
| 41 |
'wrap' => '<div class="lp-close-warning-data-ai-wrap">', |
| 42 |
'h2' => sprintf( |
| 43 |
'<div class="content-title">%s</div>', |
| 44 |
esc_html__( 'Generating data is stopped', 'learnpress' ) |
| 45 |
), |
| 46 |
'desc' => sprintf( |
| 47 |
'<p class="desc">%s</p>', |
| 48 |
esc_html__( 'The process of generating data has been canceled.', 'learnpress' ) |
| 49 |
), |
| 50 |
'wrap-end' => '</div>', |
| 51 |
'wrap-script-template-end' => '</script>', |
| 52 |
]; |
| 53 |
|
| 54 |
return Template::combine_components( $components ); |
| 55 |
} |
| 56 |
} |
| 57 |
|