| 1 |
<?php namespace Datafeedr\Api\Subscribers; |
| 2 |
|
| 3 |
use Datafeedr\Api\Templates\Template; |
| 4 |
use Datafeedr\Api\Wuwei\Event\Subscriber_Interface; |
| 5 |
|
| 6 |
/** |
| 7 |
* Class TestAdminNotice |
| 8 |
* |
| 9 |
* @since 2.0.0 |
| 10 |
*/ |
| 11 |
class TestAdminNotice extends Subscriber implements Subscriber_Interface { |
| 12 |
|
| 13 |
/** |
| 14 |
* {@inheritdoc} |
| 15 |
*/ |
| 16 |
public static function get_subscribed_events() { |
| 17 |
return array( |
| 18 |
'admin_notices' => 'handle', |
| 19 |
); |
| 20 |
} |
| 21 |
|
| 22 |
/** |
| 23 |
* Echo notice if needed. |
| 24 |
* |
| 25 |
* @since 2.0.0 |
| 26 |
*/ |
| 27 |
public function handle() { |
| 28 |
|
| 29 |
$classes = 'notice-info'; |
| 30 |
$message = __( 'Testing admin notices and templates. ', 'datafeedr/api' ); |
| 31 |
|
| 32 |
$data = array( |
| 33 |
'classes' => esc_attr( $classes ), |
| 34 |
'message' => esc_html( $message ), |
| 35 |
); |
| 36 |
|
| 37 |
echo ( new Template( 'admin/notices', $data ) )->render(); |
| 38 |
} |
| 39 |
} |