How to use a "global" field type ?
Created 7 years ago by tghpowHi, I have a slider of images on many pages. Is there a way to to create a "global" field type of files ? Like this, i can manage my pictures and use this field type on some pages. Pictures we'll be the same at every pages. Thanks. EDIT: Sorry, i just see "variables" module... My fault
If you don't already have anything implemented, you could give the Variables Module a try: https://pyrocms.com/documentation/variables-module/latest
You make a field (image or file field in this case) and then make a group, and assign that field to the group. Then in Variables you upload your image. You should be able to then output that image in any twig file.
So i create a group => theme_variables and a field => slider_top.
When a try a dd in my template like that: {{ dd(variable('theme_variables', 'slider_top' )) }}
I have this error: "An exception has been thrown during the rendering of a template ("SQLSTATE[42S02]: Base table or view not found: 1146 Table 'agrisymbiose.agrisymbiose_variables ▶"
Agrisymbiose is the name of my theme.
I have this table in my bdd: agrisymbiose_variables_theme_variable and agrisymbiose_variables_slider_top. But effectivly, i havent the table 'agrisymbiose.agrisymbiose_variables'. Did i miss something ?
@ryanthompson I think i know why: I changed the group name / slug after i had assigned a field type. Maybe it's the cause of this bug ? I deleted my group and my field type and i created them again (different name/slug) and now it's work fine.
If you don't already have anything implemented, you could give the Variables Module a try: https://pyrocms.com/documentation/variables-module/latest
You make a field (image or file field in this case) and then make a group, and assign that field to the group. Then in Variables you upload your image. You should be able to then output that image in any twig file.