-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add symfony config for block names
- Loading branch information
Showing
7 changed files
with
109 additions
and
19 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Frosh\DevelopmentHelper\Component\DependencyInjection; | ||
|
||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
|
||
class Configuration implements ConfigurationInterface | ||
{ | ||
public function getConfigTreeBuilder(): TreeBuilder | ||
{ | ||
$treeBuilder = new TreeBuilder('frosh_development_helper'); | ||
|
||
$rootNode = $treeBuilder->getRootNode(); | ||
$rootNode | ||
->children() | ||
->arrayNode('twig') | ||
->children() | ||
->arrayNode('exclude_keywords') | ||
->scalarPrototype() | ||
->end() | ||
; | ||
|
||
return $treeBuilder; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/Component/DependencyInjection/FroshDevelopmentHelperExtension.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,31 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Frosh\DevelopmentHelper\Component\DependencyInjection; | ||
|
||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Extension\Extension; | ||
|
||
class FroshDevelopmentHelperExtension extends Extension | ||
{ | ||
public function load(array $configs, ContainerBuilder $container) | ||
{ | ||
$config = $this->processConfiguration($this->getConfiguration($configs, $container), $configs); | ||
$this->addConfig($container, $this->getAlias(), $config); | ||
} | ||
|
||
public function getConfiguration(array $config, ContainerBuilder $container): Configuration | ||
{ | ||
return new Configuration(); | ||
} | ||
|
||
private function addConfig(ContainerBuilder $container, string $alias, array $options): void | ||
{ | ||
foreach ($options as $key => $option) { | ||
$container->setParameter($alias . '.' . $key, $option); | ||
|
||
if (\is_array($option)) { | ||
$this->addConfig($container, $alias . '.' . $key, $option); | ||
} | ||
} | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
src/Resources/config/packages/frosh_development_helper.yaml
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,10 @@ | ||
frosh_development_helper: | ||
twig: | ||
exclude_keywords: | ||
- form_action | ||
- class | ||
- attribute | ||
- title | ||
- sitemap | ||
- head_meta_tags | ||
- page_checkout_additional |
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