Traits

HasNotices

v1.0.0

Adds WordPress admin notice helpers for info, success, warning, and error states.

Use Trait

use Meteorack\Sdk\RuntimeWp\Traits\HasNotices;

How To Use It

  • Use these helpers for admin-facing feedback that should appear in the standard WordPress notices area.
  • Prefer semantic helpers like addSuccessNotice() and addErrorNotice() so the notice styling matches the intent without manual class names.

Helpers

protected function addNotice(string $message, string $type = 'info', bool $dismissible = true): void

Queues an admin notice with an explicit notice type.

protected function addSuccessNotice(string $message): void

Queues a success notice.

protected function addWarningNotice(string $message): void

Queues a warning notice.

protected function addErrorNotice(string $message): void

Queues an error notice.

Example

bootstrap.php
public function handleLicenseFailure(): void
{
    $this->addErrorNotice('License validation failed. Please re-enter your key.');
    $this->getSdkContext()->logger()->warn('reports.license_notice_shown', []);
}