| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
/** |
| 6 |
* BeyondWords Post Inspect Panel. |
| 7 |
* |
| 8 |
* Text Domain: beyondwords |
| 9 |
* |
| 10 |
* @package Beyondwords\Wordpress |
| 11 |
* @author Stuart McAlpine <stu@beyondwords.io> |
| 12 |
* @since 3.0.0 |
| 13 |
*/ |
| 14 |
|
| 15 |
namespace Beyondwords\Wordpress\Component\Post\Sidebar; |
| 16 |
|
| 17 |
use Beyondwords\Wordpress\Component\Settings\PostTypes\PostTypes; |
| 18 |
use Beyondwords\Wordpress\Component\Settings\SettingsUtils; |
| 19 |
use Beyondwords\Wordpress\Core\CoreUtils; |
| 20 |
|
| 21 |
/** |
| 22 |
* Sidebar setup |
| 23 |
* |
| 24 |
* @since 3.0.0 |
| 25 |
*/ |
| 26 |
class Sidebar |
| 27 |
{ |
| 28 |
/** |
| 29 |
* Constructor |
| 30 |
*/ |
| 31 |
public function __construct() |
| 32 |
{ |
| 33 |
add_action('enqueue_block_assets', array($this, 'enqueueBlockAssets')); |
| 34 |
} |
| 35 |
|
| 36 |
public function enqueueBlockAssets() |
| 37 |
{ |
| 38 |
if (CoreUtils::isGutenbergPage()) { |
| 39 |
$postType = get_post_type(); |
| 40 |
|
| 41 |
$postTypes = SettingsUtils::getSupportedPostTypes(); |
| 42 |
|
| 43 |
if (in_array($postType, $postTypes)) { |
| 44 |
// Register the Block Editor "Sidebar" CSS |
| 45 |
wp_enqueue_style( |
| 46 |
'beyondwords-Sidebar', |
| 47 |
BEYONDWORDS__PLUGIN_URI . 'src/Component/Post/Sidebar/PostSidebar.css', |
| 48 |
array(), |
| 49 |
BEYONDWORDS__PLUGIN_VERSION |
| 50 |
); |
| 51 |
} |
| 52 |
} |
| 53 |
} |
| 54 |
} |
| 55 |
|