# gdpr-framework/trunk/src/Admin/AdminNotice.php

The GDPR Framework By Data443, version trunk. 42 lines.

- Page: https://pluginprobe.com/plugins/gdpr-framework/trunk/code/src/Admin/AdminNotice.php
- Raw: https://pluginprobe.com/plugins/gdpr-framework/trunk/raw/src/Admin/AdminNotice.php
- Modified: 2026-05-26T15:35:52+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/trunk/code/src/Admin/AdminNotice.php#L10-L20`.

```php
<?php

namespace Codelight\GDPR\Admin;

if ( ! defined( 'ABSPATH' ) ) exit;

class AdminNotice
{
    protected $template;

    protected $data;

    /**
     * AdminNotice constructor.
     */
    public function __construct()
    {
        if (did_action('admin_notices')) {
            trigger_error('AdminNotice class called incorrectly - admin_notices action has already ran!', E_USER_ERROR);
        }

        add_action('admin_notices', [$this, 'render'], 9999);
    }

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

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

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

```
