Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
12.50% covered (danger)
12.50%
1 / 8
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
ErrorNotice
12.50% covered (danger)
12.50%
1 / 8
50.00% covered (danger)
50.00%
1 / 2
9.03
0.00% covered (danger)
0.00%
0 / 1
 init
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 enqueueBlockAssets
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
6
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     */
29    public function init()
30    {
31        add_action('enqueue_block_assets', array($this, 'enqueueBlockAssets'));
32    }
33
34    public function enqueueBlockAssets()
35    {
36        // Only enqueue for Gutenberg screens
37        if (CoreUtils::isGutenbergPage()) {
38            // Register the Block Editor "Error Notice" CSS
39            wp_enqueue_style(
40                'beyondwords-ErrorNotice',
41                BEYONDWORDS__PLUGIN_URI . 'src/Component/Post/ErrorNotice/error-notice.css',
42                array(),
43                BEYONDWORDS__PLUGIN_VERSION
44            );
45        }
46    }
47}