Skip to content

Commit

Permalink
fixing paver 0.0.5 compatibility issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyvr committed Oct 16, 2024
1 parent f3783f1 commit dd05580
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,12 @@ function media()
'strategy' => 'defer'
]);

foreach (paver()->blocks() as $key => $block) {
$blockInstance = BlockFactory::createById($key);

foreach ($blockInstance->styles as $style) {
foreach (paver()->blocks(withInstance: true) as $block) {
foreach ($block['instance']->styles as $style) {
wp_enqueue_style($style['handle'], $style['src'], $style['deps']);
}

foreach ($blockInstance->scripts as $script) {
foreach ($block['instance']->scripts as $script) {
wp_enqueue_script($script['handle'], $script['src'], $script['deps']);
}
}
Expand Down Expand Up @@ -228,10 +226,8 @@ function styles()
{
$output = $this->editorStyles();

foreach (paver()->blocks() as $key => $block) {
$blockInstance = BlockFactory::createById($key);

foreach ($blockInstance->styles as $style) {
foreach (paver()->blocks(withInstance: true) as $block) {
foreach ($block['instance']->styles as $style) {
$output .= '<link rel="stylesheet" href="' . $style['src'] . '">';
}
}
Expand All @@ -243,10 +239,8 @@ function scripts()
{
$output = '';

foreach (paver()->blocks() as $key => $block) {
$blockInstance = BlockFactory::createById($key);

foreach ($blockInstance->scripts as $script) {
foreach (paver()->blocks(withInstance: true) as $block) {
foreach ($block['instance']->scripts as $script) {
$output .= '<script src="' . $script['src'] . '"></script>';
}
}
Expand Down

0 comments on commit dd05580

Please sign in to comment.