Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I can see the custom layout example, but where are they added so they are seen by the module?
Comment | File | Size | Author |
---|---|---|---|
#2 | my_module.zip | 2.26 KB | skorzh |
#2 | region_widgets.png | 76.39 KB | skorzh |
Comments
Comment #1
dshields CreditAttribution: dshields at OpenConcept Consulting Inc. commentedThey are instantiated within the includes directory, defined within the views directory and styled within the css directory.
Comment #2
skorzhHello Danielle, you can use default views template overrides rules.
For example:
You have views 'cars' with display 'page', you set 'Basic (with layout)' exposed form style and chose 'VEFL Three columns' layout.
Module provides default views-exposed-form.tpl.php file. In this template
$region_widgets
variable is available, this variable contains array of widgets separated by regions (see attached screenshot).You can override default template and provide your own views-exposed-form template. To do it in your theme folder you have to create views-exposed-form.tpl.php file (or copy from module's default).
views-exposed-form.tpl.php -- will work for exposed forms in all views
views-exposed-form--cars.tpl.php -- will work for exposed forms in 'cars' views
views-exposed-form--cars--page.tpl.php -- will work for exposed forms in 'cars' views with display 'page'
You can find more info how overrides work here.
Example of custom layout:
In your module implement hook_vefl_layouts() hook, see an example here.
After cache clear on exposed form settings page you will see defined layout. Chose this layout and save the form.
Copy default module's views-exposed-form.tpl.php template to your theme folder and rename it to views-exposed-form--VIEWSNAME--DISPLAYNAME.tpl.php, in my case its views-exposed-form--cars--page.tpl.php.
Output there all widgets from
$region_widgets
variable.You could find examples of module and template file in attachments.
If you have any other questions, you ask here or in https://www.drupal.org/node/2497355
Comment #3
Dinis CreditAttribution: Dinis commentedMany thanks :)
Comment #4
Dinis CreditAttribution: Dinis commentedComment #5
ilclaudio CreditAttribution: ilclaudio commentedHi,
how can I add the same template with Drupal8?
Is it possible?
Thank you
cld