Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
ErrorNotice
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
2 / 2
3
100.00% covered (success)
100.00%
1 / 1
 init
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 enqueueBlockAssets
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3declare(strict_types=1);
4
5/**
6 * BeyondWords Post ErrorNotice.
7 *
8 * @package Beyondwords\Wordpress
9 * @author  Stuart McAlpine <stu@beyondwords.io>
10 * @since   3.0.0
11 */
12
13namespace Beyondwords\Wordpress\Component\Post\ErrorNotice;
14
15use Beyondwords\Wordpress\Core\CoreUtils;
16
17/**
18 * ErrorNotice
19 *
20 * @since 3.0.0
21 */
22class ErrorNotice
23{
24    /**
25     * Init.
26     *
27     * @since 4.0.0
28     * @since 6.0.0 Make static.
29     */
30    public static function init()
31    {
32        add_action('enqueue_block_assets', [self::class, 'enqueueBlockAssets']);
33    }
34
35    /**
36     * Enqueue Block Editor assets.
37     *
38     * @since 6.0.0 Make static.
39     */
40    public static function enqueueBlockAssets()
41    {
42        // Only enqueue for Gutenberg screens
43        if (CoreUtils::isGutenbergPage()) {
44            // Register the Block Editor "Error Notice" CSS
45            wp_enqueue_style(
46                'beyondwords-ErrorNotice',
47                BEYONDWORDS__PLUGIN_URI . 'src/Component/Post/ErrorNotice/error-notice.css',
48                [],
49                BEYONDWORDS__PLUGIN_VERSION
50            );
51        }
52    }
53}