Skip to content

Commit

Permalink
Fix: User default twig namespace to easily override
Browse files Browse the repository at this point in the history
  • Loading branch information
Hannes Giesenow committed Jul 25, 2024
1 parent 1db292f commit 4508606
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions config/ezplatform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ ezplatform:
system:
default:
field_templates:
- { template: '@ElbformatIconFieldtype/icon_field.html.twig', priority: 0 }
- { template: '@ElbformatIcon/icon_field.html.twig', priority: 0 }
fielddefinition_edit_templates:
- { template: '@ElbformatIconFieldtype/icon_field_type_definition.html.twig', priority: 0 }
- { template: '@ElbformatIcon/icon_field_type_definition.html.twig', priority: 0 }
3 changes: 0 additions & 3 deletions src/DependencyInjection/ElbformatIconExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ public function prepend(ContainerBuilder $container): void
$config = Yaml::parse($configFile);
$container->prependExtensionConfig('ezpublish', $config['ezplatform']);

// Register namespace (as this is not done automatically. Maybe the missing "bundle" in path?)
$container->prependExtensionConfig('twig', ['paths' => [__DIR__.'/../../templates' => 'ElbformatIconFieldtype']]);

// Register translations (as this is not done automatically. Maybe the missing "bundle" in path?)
$container->prependExtensionConfig('framework', ['translator' => ['paths' => [__DIR__.'/../../translations']]]);

Expand Down
2 changes: 1 addition & 1 deletion src/Form/Type/IconType.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
$iconList = $this->iconSetManager->getSet($iconSet)->getList();
$iconTemplates = [];
foreach($iconList as $icon) {
$iconTemplates[$icon] = $this->twig->render('@ElbformatIconFieldtype/icon.html.twig', ['icon' => $icon,'iconset' => $iconSet]);
$iconTemplates[$icon] = $this->twig->render('@ElbformatIcon/icon.html.twig', ['icon' => $icon,'iconset' => $iconSet]);
}
$builder->add('icon', ChoiceType::class, [
'choices' => $iconList,
Expand Down
2 changes: 1 addition & 1 deletion templates/icon_field.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% block icon_field %}
<div class="elbformat-icon">
<div class="icon-container">
{{ include('@ElbformatIconFieldtype/icon.html.twig', {
{{ include('@ElbformatIcon/icon.html.twig', {
icon: field.value.icon,
iconset: fieldSettings.iconset
}, with_context=false) }}
Expand Down

0 comments on commit 4508606

Please sign in to comment.