Skip to content

Commit

Permalink
✨ Add Alpine compatibility to block previews (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x authored Aug 12, 2024
1 parent c80c52d commit 3691d55
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions resources/views/alpine-support.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script type="text/javascript">
acf.addFilter('acf_blocks_parse_node_attr', (current, node) => node.name.startsWith('x-') ? node : current);
</script>
4 changes: 4 additions & 0 deletions src/AcfComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ public function boot(): void

add_filter('acf/init', fn () => $this->handleComposers(), config('acf.hookPriority', 100));

add_filter('acf/input/admin_footer', function () {
echo view('acf-composer::alpine-support')->render();
});

$this->booted = true;
}

Expand Down
1 change: 1 addition & 0 deletions src/Providers/AcfComposerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function boot()
__DIR__.'/../../config/acf.php' => $this->app->configPath('acf.php'),
], 'acf-composer');

$this->loadViewsFrom(__DIR__.'/../../resources/views', 'acf-composer');
$this->mergeConfigFrom(__DIR__.'/../../config/acf.php', 'acf');

$composer = $this->app->make('AcfComposer');
Expand Down

0 comments on commit 3691d55

Please sign in to comment.