Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Livewire widget #4971

Merged
merged 12 commits into from
Sep 29, 2023
23 changes: 23 additions & 0 deletions src/resources/views/ui/widgets/livewire.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@php
// defaults; backwards compatibility with Backpack 4.0 widgets
$widget['wrapper']['class'] = $widget['wrapper']['class'] ?? $widget['wrapperClass'] ?? 'col-sm-6 col-lg-3';
@endphp

@includeWhen(!empty($widget['wrapper']), backpack_view('widgets.inc.wrapper_start'))

<div class="{{ $widget['class'] ?? 'card' }}" @foreach($widget['attributes'] ?? [] as $key => $value) {{ $key }}="{{ $value }}" @endforeach>
@livewire($widget['content'], $widget['parameters'] ?? [])
</div>

@includeWhen(!empty($widget['wrapper']), backpack_view('widgets.inc.wrapper_end'))

@if($widget['livewireAssets'] ?? false)
@pushOnce('after_styles')
@livewireStyles
@endPushOnce

@pushOnce('after_scripts')
@livewireScripts
@endpushOnce
@endif