include instructions on how to leverage symfony/twig features
Open
@matks is already working on this.
Since Jun 26, 2020.
- Dominant language
- Scala
- Stars
- 136
- Forks
- 555
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 4
Description
Hello,
I'd like to share some thoughts about things that seems to be missing from docs, but explaining them would make developing modules (and maybe other things) so much easier:
- I coulnd't find any direct mention on how to use images that are placed in module's view/img directory, the closest thing would be https://devdocs.prestashop.com/1.7/themes/getting-started/asset-management/, image files are mentioned, but I couldn't find any further explanation.
At this point, I figured it out I could usesrc="/modules/my-module/views/img/my-image.jpeg", but how can I know this is the right way? - symfony/twig has this great thing which is asset() function https://symfony.com/doc/current/templates.html#linking-to-css-javascript-and-image-assets and it would be very heplful if we knew if we could use this in back office and if answer is yes, then how we could use it.
<img src="{{ asset('???/views/img/my-image.jpeg') }}"/>
Another thing I couldn't find was an explanation on how to leverage twig template inheritance/inclusion, it would be great if docs had an example of twig template inheritance and/or inclusion, lets say I have views/templates/admin/base.html.twig template and would like to extend it, how do I do that?- Admin Controller docs page https://devdocs.prestashop.com/1.7/modules/concepts/controllers/admin-controllers/ contains an example of rendering one of module's templates, but it doesn't follow folder structure shown here https://devdocs.prestashop.com/1.7/modules/creation/module-file-structure/,
I think that it would be helpful if docs also contained an example of twig template inheritance, like
{# your-module/views/templates/admin/extends_base.html.twig #}
{% extends '@Modules/your-module/views/templates/admin/base.html.twig' %}
...
Regards
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.