-
-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Live] override data collector & debug command
- Loading branch information
Showing
10 changed files
with
106 additions
and
22 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
src/LiveComponent/src/Command/LiveComponentDebugCommand.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,12 @@ | ||
<?php | ||
|
||
namespace Symfony\UX\LiveComponent\Command; | ||
|
||
use Symfony\UX\TwigComponent\Command\TwigComponentDebugCommand; | ||
|
||
/** | ||
* @author Kevin Bond <kevinbond@gmail.com> | ||
*/ | ||
final class LiveComponentDebugCommand extends TwigComponentDebugCommand | ||
{ | ||
} |
18 changes: 18 additions & 0 deletions
18
src/LiveComponent/src/DataCollector/LiveComponentDataCollector.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,18 @@ | ||
<?php | ||
|
||
namespace Symfony\UX\LiveComponent\DataCollector; | ||
|
||
use Symfony\UX\TwigComponent\DataCollector\TwigComponentDataCollector; | ||
|
||
/** | ||
* @author Kevin Bond <kevinbond@gmail.com> | ||
* | ||
* @internal | ||
*/ | ||
final class LiveComponentDataCollector extends TwigComponentDataCollector | ||
{ | ||
public function getName(): string | ||
{ | ||
return 'live_component'; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/LiveComponent/src/DependencyInjection/Compiler/DebugLiveComponentPass.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,35 @@ | ||
<?php | ||
|
||
namespace Symfony\UX\LiveComponent\DependencyInjection\Compiler; | ||
|
||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\UX\LiveComponent\Command\LiveComponentDebugCommand; | ||
use Symfony\UX\LiveComponent\DataCollector\LiveComponentDataCollector; | ||
|
||
/** | ||
* @author Kevin Bond <kevinbond@gmail.com> | ||
* | ||
* @internal | ||
*/ | ||
final class DebugLiveComponentPass implements CompilerPassInterface | ||
{ | ||
public function process(ContainerBuilder $container): void | ||
{ | ||
if (!$container->hasDefinition('ux.twig_component.data_collector')) { | ||
return; | ||
} | ||
|
||
$container->getDefinition('ux.twig_component.data_collector') | ||
->setClass(LiveComponentDataCollector::class) | ||
->clearTag('data_collector') | ||
->addTag('data_collector', [ | ||
'template' => '@LiveComponent/Collector/live_component.html.twig', | ||
'id' => 'live_component', | ||
'priority' => 256, | ||
]); | ||
|
||
$container->getDefinition('ux.twig_component.command.debug') | ||
->setClass(LiveComponentDebugCommand::class); | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
src/LiveComponent/templates/Collector/live_component.html.twig
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,8 @@ | ||
{% extends '@TwigComponent/Collector/twig_component.html.twig' %} | ||
|
||
{% block menu %} | ||
<span class="label{{ collector.components is empty ? ' disabled' }}"> | ||
<span class="icon">{{ source('@TwigComponent/Collector/icon.svg') }}</span> | ||
<strong>Twigsss Components</strong> | ||
</span> | ||
{% endblock %} |
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
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
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