Banner
in package
Uses
UtilsProvider
Main banner.
Table of Contents
Constants
- ACTION_CLEAR_CURRENT_COOKIE = 'rcb-clear-current-cookie'
- DESIGN_VERSION = 10
- The design version is incremented each time, we need to distinguish between some UI elements within our cookie banner and content blockers. For example, in a recent version of Real Cookie Banner we removed the footer for content blockers completely, but to be compliant with our documentation we still want to show footers for older consents in our "List of consents".
- HTML_ATTRIBUTE_UNIQUE_WRITE_NAME = 'unique-write-name'
- Example:
Properties
- $customize : BannerCustomize
- The customize handler
Methods
- admin_bar_menu() : mixed
- Show a "Show banner again" button in the admin toolbar in frontend.
- getCustomize() : mixed
- Getter.
- getPluginConstantPrefix() : string
- Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
- instance() : mixed
- New instance.
- shouldLoadAssets() : mixed
- Checks if the banner is active for the current page. This does not check any user relevant conditions because they need to be done in frontend (caching).
- wp_body_open() : mixed
- Print out the overlay at `wp_body_open`. See also `wp_footer` for backwards-compatibilty.
- wp_footer() : mixed
- Print out the overlay at `wp_footer` time but only when `wp_body_open` was not yet called (some themes do not support it).
- wp_head() : mixed
- The `codeOnPageLoad` can be directly rendered to the Output Buffer cause it does not stand in conflict with any caching plugin (no conditional rendering).
- poweredLink() : mixed
- Get the "Powered by" link.
- printOverlay() : mixed
- Print out the overlay so it is server-side rendered (avoid flickering as early as possible).
- __construct() : mixed
- C'tor.
Constants
ACTION_CLEAR_CURRENT_COOKIE
public
mixed
ACTION_CLEAR_CURRENT_COOKIE
= 'rcb-clear-current-cookie'
DESIGN_VERSION
The design version is incremented each time, we need to distinguish between some UI elements within our cookie banner and content blockers. For example, in a recent version of Real Cookie Banner we removed the footer for content blockers completely, but to be compliant with our documentation we still want to show footers for older consents in our "List of consents".
public
mixed
DESIGN_VERSION
= 10
For the chronically changes have a look at the @devowl-wp/react-cookie-banner
package.
HTML_ATTRIBUTE_UNIQUE_WRITE_NAME
Example:
public
mixed
HTML_ATTRIBUTE_UNIQUE_WRITE_NAME
= 'unique-write-name'
<script unique-write-name="gtag">console.log("this gets written to DOM");</script>
<script unique-write-name="gtag">console.log("this gets skipped");</script>
Properties
$customize
The customize handler
private
BannerCustomize
$customize
Methods
admin_bar_menu()
Show a "Show banner again" button in the admin toolbar in frontend.
public
admin_bar_menu(WP_Admin_Bar $admin_bar) : mixed
Parameters
- $admin_bar : WP_Admin_Bar
getCustomize()
Getter.
public
getCustomize() : mixed
Tags
getPluginConstantPrefix()
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
public
getPluginConstantPrefix() : string
Tags
Return values
stringinstance()
New instance.
public
static instance() : mixed
Tags
shouldLoadAssets()
Checks if the banner is active for the current page. This does not check any user relevant conditions because they need to be done in frontend (caching).
public
shouldLoadAssets(string $context) : mixed
Parameters
- $context : string
-
The context passed to
Assets#enqueue_script_and_styles
Tags
wp_body_open()
Print out the overlay at `wp_body_open`. See also `wp_footer` for backwards-compatibilty.
public
wp_body_open() : mixed
wp_footer()
Print out the overlay at `wp_footer` time but only when `wp_body_open` was not yet called (some themes do not support it).
public
wp_footer() : mixed
wp_head()
The `codeOnPageLoad` can be directly rendered to the Output Buffer cause it does not stand in conflict with any caching plugin (no conditional rendering).
public
wp_head() : mixed
poweredLink()
Get the "Powered by" link.
protected
poweredLink() : mixed
printOverlay()
Print out the overlay so it is server-side rendered (avoid flickering as early as possible).
protected
printOverlay() : mixed
See also inlineStyle.tsx#overlay for more information!
__construct()
C'tor.
private
__construct() : mixed