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

EZP-24765: Give possibility to set additional paths for a given theme #5

Merged
merged 1 commit into from
Jun 23, 2017

Conversation

lolautruche
Copy link
Contributor

https://jira.ez.no/browse/EZP-27465

This patch makes it possible to add arbitrary Twig template directories to a theme from configuration.

This can be useful when you want to define templates from third-party bundles as part of one of your themes, or when upgrading your application in order to use eZ Platform design engine, and that your existing templates are not yet following the convention.

Practical use case would be to define a standard theme for templates provided by the kernel.

ezdesign:
    design_list:
        my_design: [my_theme, some_other_theme]
    template_theme_paths:
        # FOSUserBundle templates will be part of "my_theme" theme
        my_theme:
            - '%kernel.root_dir%/../vendor/friendsofsymfony/user-bundle/Resources/views'

@lolautruche
Copy link
Contributor Author

Ping @andrerom @bdunogier

doc/templates.md Outdated
template_theme_paths:
# FOSUserBundle templates will be part of "my_theme" theme
my_theme:
- '%kernel.root_dir%/../vendor/friendsofsymfony/user-bundle/Resources/views'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On sf 3.3 there is also kernel.project_dir, but doesn't make much of a differance here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was tempted to use %kernel.project_dir% but as we don't require Symfony 3.3 yet, I preferred using the old fashion way 😛

Copy link
Member

@bdunogier bdunogier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming is hard.

->arrayNode('template_theme_paths')
->useAttributeAsKey('theme')
->example(['some_theme' => ['/var/foo/some_theme_dir', '/another/theme/dir']])
->info('Collection of template paths by theme.')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I'd make templates plural, and update the setting name. I know we've spent time on it, but it sounds wrong now :)

Funnily enough, it is reversed in the container parameter's name: ezdesign.templates_path_map 😉

doc/templates.md Outdated
@@ -41,6 +41,25 @@ Default fallback order is the following:

> Bundle fallback order is the instantiation order in `AppKernel`.

### Additional theme paths
In addition to the convention described above, it is also possible to add arbitrary Twig template directories to a theme
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

templates ?

@lolautruche lolautruche force-pushed the feat/configuredThemePaths branch from 93e15f6 to 823b2ff Compare June 16, 2017 09:46
> https://jira.ez.no/browse/EZP-27465

This patch makes it possible to add arbitrary Twig template directories to a theme from configuration.
This can be useful when you want to define templates from third-party bundles as part of one of your themes,
or when upgrading your application in order to use eZ Platform design engine, and that your existing templates
are not yet following the convention.

Practical use case would be to define a `standard` theme for templates provided by the kernel.

```yaml
ezdesign:
    design_list:
        my_design: [my_theme, some_other_theme]
    templates_theme_paths:
        # FOSUserBundle templates will be part of "my_theme" theme
        my_theme:
            - '%kernel.root_dir%/../vendor/friendsofsymfony/user-bundle/Resources/views'
```
@lolautruche lolautruche force-pushed the feat/configuredThemePaths branch from 823b2ff to d2eb415 Compare June 16, 2017 09:48
@lolautruche
Copy link
Contributor Author

@bdunogier Fixed

@lolautruche
Copy link
Contributor Author

@bdunogier ping ? 😃

@lolautruche lolautruche merged commit 91a64e1 into master Jun 23, 2017
@lolautruche lolautruche deleted the feat/configuredThemePaths branch June 23, 2017 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants