| 1 |
<?php |
| 2 |
|
| 3 |
namespace Codelight\GDPR\Admin; |
| 4 |
|
| 5 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 6 |
|
| 7 |
class Modal |
| 8 |
{ |
| 9 |
protected $id; |
| 10 |
|
| 11 |
protected $template; |
| 12 |
|
| 13 |
protected $data; |
| 14 |
|
| 15 |
/** |
| 16 |
* AdminNotice constructor. |
| 17 |
*/ |
| 18 |
public function __construct() |
| 19 |
{ |
| 20 |
add_action('admin_footer', [$this, 'render']); |
| 21 |
} |
| 22 |
|
| 23 |
public function add($id, $template, $data = []) |
| 24 |
{ |
| 25 |
$this->id = $id; |
| 26 |
$this->template = $template; |
| 27 |
$this->data = $data; |
| 28 |
$this->data['id'] = $this->id; |
| 29 |
} |
| 30 |
|
| 31 |
public function render() |
| 32 |
{ |
| 33 |
if (!$this->template) { |
| 34 |
return; |
| 35 |
} |
| 36 |
|
| 37 |
echo gdpr('view')->render('admin/modals/header', $this->data); |
| 38 |
echo gdpr('view')->render($this->template, $this->data); |
| 39 |
echo gdpr('view')->render('admin/modals/footer', $this->data); |
| 40 |
} |
| 41 |
} |
| 42 |
|