# gdpr-framework/2.1.0/src/Admin/Modal.php

The GDPR Framework By Data443, version 2.1.0. 40 lines.

- Page: https://pluginprobe.com/plugins/gdpr-framework/2.1.0/code/src/Admin/Modal.php
- Raw: https://pluginprobe.com/plugins/gdpr-framework/2.1.0/raw/src/Admin/Modal.php
- Modified: 2022-03-03T17:26:16+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/gdpr-framework/2.1.0/code/src/Admin/Modal.php#L10-L20`.

```php
<?php

namespace Codelight\GDPR\Admin;

class Modal
{
    protected $id;

    protected $template;

    protected $data;

    /**
     * AdminNotice constructor.
     */
    public function __construct()
    {
        add_action('admin_footer', [$this, 'render']);
    }

    public function add($id, $template, $data = [])
    {
        $this->id = $id;
        $this->template = $template;
        $this->data = $data;
        $this->data['id'] = $this->id;
    }

    public function render()
    {
        if (!$this->template) {
            return;
        }

        echo gdpr('view')->render('admin/modals/header', $this->data);
        echo gdpr('view')->render($this->template, $this->data);
        echo gdpr('view')->render('admin/modals/footer', $this->data);
    }
}

```
