Skip to content

Commit e1b5b05

Browse files
committed
feat(integrations): add editor scripts and styles
1 parent cb24300 commit e1b5b05

File tree

4 files changed

+58
-2
lines changed

4 files changed

+58
-2
lines changed

config/app.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737

3838
CommonIntegrations\ACF::class,
3939
CommonIntegrations\ACFBlockCreator::class,
40-
CommonIntegrations\Editor::class,
40+
41+
// Block Editor Integration
42+
CommonIntegrations\Editor\Editor::class,
4143

4244
Customizer\Customizer::class,
4345
ReusableContent\ReusableContentHooks::class,

src/classes/Common/Integrations/Editor.php renamed to src/classes/Common/Integrations/Editor/Editor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare(strict_types=1);
44

5-
namespace DoWStarterTheme\Common\Integrations;
5+
namespace DoWStarterTheme\Common\Integrations\Editor;
66

77
use DoWStarterTheme\Common\Contracts\Hookable;
88
use DoWStarterTheme\Common\Config\Config;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace DoWStarterTheme\Common\Integrations\Editor;
6+
7+
use DoWStarterTheme\Common\Assets\Script;
8+
9+
/**
10+
* Editor Script asset class.
11+
*
12+
* This class is responsible for enqueuing scripts in the block editor.
13+
*/
14+
class EditorScript extends Script
15+
{
16+
/**
17+
* Enqueues asset.
18+
*
19+
* @action enqueue_block_editor_assets
20+
*
21+
* @return void
22+
*/
23+
public function enqueueAsset(): void
24+
{
25+
$this->enqueue();
26+
}
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace DoWStarterTheme\Common\Integrations\Editor;
6+
7+
use DoWStarterTheme\Common\Assets\Style;
8+
9+
/**
10+
* Editor Style asset class.
11+
*/
12+
class EditorStyle extends Style
13+
{
14+
protected string $name = 'style-editor';
15+
16+
/**
17+
* Enqueues asset.
18+
*
19+
* @action enqueue_block_editor_assets
20+
*
21+
* @return void
22+
*/
23+
public function enqueueAsset(): void
24+
{
25+
$this->enqueue();
26+
}
27+
}

0 commit comments

Comments
 (0)