Skip to content
Snippets Groups Projects
Commit 393e0c0b authored by Grzegorz Rola's avatar Grzegorz Rola
Browse files

Feature/readme

parent f392e425
No related branches found
No related tags found
1 merge request!22Feature/readme
......@@ -82,3 +82,27 @@ wpdesk_permanent_dismissible_wp_notice( 'Notice text goes here', 'notice-name' )
// Is equivalent to
$notice = new \WPDesk\Notice\PermanentDismissibleNotice( 'Notice text goes here', 'notice-name' );
```
## Project documentation
### AJAX handler
To use permanent dismissible notices AJAX handler must be created and hooks initialized:
```php
wpdesk_init_wp_notice_ajax_handler();
// Is equivalent to:
( new \WPDesk\Notice\AjaxHandler() )->hooks();
```
### Displaying
To display permanent dismissible notice:
```php
wpdesk_permanent_dismissible_wp_notice( 'Notice text goes here', 'notice-name' );
// Is equivalent to
$notice = new \WPDesk\Notice\PermanentDismissibleNotice( 'Notice text goes here', 'notice-name' );
```
......@@ -44,6 +44,9 @@ class TestAjaxHandler extends WP_UnitTestCase
{
$ajaxHandler = new AjaxHandler(self::ASSETS_URL);
$ajaxHandler->hooks();
global $current_screen;
$current_screen = new stdClass();
$current_screen->id = 'test';
do_action('admin_enqueue_scripts');
$registeredScripts = wp_scripts()->registered;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment