-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #708 from tighten/fix-dynamic-components
Fix dynamic components
- Loading branch information
Showing
5 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace TightenCo\Jigsaw\View; | ||
|
||
use Illuminate\Container\Container; | ||
use Illuminate\View\DynamicComponent as BaseDynamnicComponent; | ||
|
||
class DynamicComponent extends BaseDynamnicComponent | ||
{ | ||
protected function compiler() | ||
{ | ||
if (! static::$compiler) { | ||
static::$compiler = new ComponentTagCompiler( | ||
Container::getInstance()->make('blade.compiler')->getClassComponentAliases(), | ||
Container::getInstance()->make('blade.compiler')->getClassComponentNamespaces(), | ||
Container::getInstance()->make('blade.compiler') | ||
); | ||
} | ||
|
||
return static::$compiler; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
tests/snapshots/dynamic-component/source/_components/alert.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div class="alert alert-danger"> | ||
<h3>This is the component</h3> | ||
<h4>Named title slot: {{ $title }}</h4> | ||
<hr> | ||
{{ $slot }} | ||
<hr> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@php | ||
$dynamic = 'alert'; | ||
@endphp | ||
<x-dynamic-component :component="$dynamic" title="Title"> | ||
Slot | ||
</x-dynamic-component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div class="alert alert-danger"> | ||
<h3>This is the component</h3> | ||
<h4>Named title slot: Title</h4> | ||
<hr> | ||
Slot | ||
<hr> | ||
</div> |