Files
2026-06-29 19:54:12 +02:00

40 lines
1.1 KiB
PHP

<?php
use AcornPlugin\Acorn\BootCoordinator;
use AcornPlugin\Acorn\LivewireAssets;
use Roots\Acorn\Application;
include_once __DIR__ . '/vendor/autoload.php';
// Plugin requires WP Acorn
if (! class_exists(Application::class)) {
wp_die(
esc_html__('You need to install Acorn to use this site.', 'acorn-starter'),
'',
[
'link_url' => 'https://roots.io/acorn/docs/installation/',
'link_text' => esc_html__('Acorn Docs: Installation', 'acorn-starter'),
]
);
}
add_action('after_setup_theme', function () {
$coordinator = new BootCoordinator();
// Another Acorn plugin already booted the framework this request. Our
// provider is auto-discovered (composer.json extra.acorn.providers), so
// there is nothing left to do.
if (! $coordinator->shouldBoot()) {
return;
}
Application::configure()
->withRouting(wordpress: true)
->boot();
$coordinator->markBooted();
// Livewire assets are a global concern — emit once, from the elected owner.
LivewireAssets::registerOnce();
}, 0);