Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wp-notice
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wpdesk
wp-notice
Commits
393e0c0b
Commit
393e0c0b
authored
3 years ago
by
Grzegorz Rola
Browse files
Options
Downloads
Patches
Plain Diff
Feature/readme
parent
f392e425
No related branches found
No related tags found
1 merge request
!22
Feature/readme
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+24
-0
24 additions, 0 deletions
README.md
tests/integration/TestAjaxHandler.php
+3
-0
3 additions, 0 deletions
tests/integration/TestAjaxHandler.php
with
27 additions
and
0 deletions
README.md
+
24
−
0
View file @
393e0c0b
...
...
@@ -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'
);
```
This diff is collapsed.
Click to expand it.
tests/integration/TestAjaxHandler.php
+
3
−
0
View file @
393e0c0b
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment