I can see the custom layout example, but where are they added so they are seen by the module?

CommentFileSizeAuthor
#2 my_module.zip2.26 KBskorzh
#2 region_widgets.png76.39 KBskorzh
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dshields’s picture

They are instantiated within the includes directory, defined within the views directory and styled within the css directory.

skorzh’s picture

FileSize
76.39 KB
2.26 KB

Hello 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.

<div class="<?php print implode(' ', $classes_array); ?>">

  <div class="vefl-region vefl-region-top">
    <?php foreach ($region_widgets['top'] as $id => $widget): ?>
      <?php print theme('views_exposed_widget', array('widget' => $widget)); ?>
    <?php endforeach; ?>
  </div>

  <div class="vefl-region-content">
    <div class="vefl-region vefl-region-left">
      <?php foreach ($region_widgets['left'] as $id => $widget): ?>
        <?php print theme('views_exposed_widget', array('widget' => $widget)); ?>
      <?php endforeach; ?>
    </div>
    <div class="vefl-region vefl-region-right">
      <?php foreach ($region_widgets['right'] as $id => $widget): ?>
        <?php print theme('views_exposed_widget', array('widget' => $widget)); ?>
      <?php endforeach; ?>
    </div>
  </div>

  <div class="vefl-region vefl-region-bottom">
    <?php foreach ($region_widgets['bottom'] as $id => $widget): ?>
      <?php print theme('views_exposed_widget', array('widget' => $widget)); ?>
    <?php endforeach; ?>
  </div>
</div>

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

Dinis’s picture

Many thanks :)

Dinis’s picture

Status: Active » Closed (fixed)
ilclaudio’s picture

Hi,
how can I add the same template with Drupal8?
Is it possible?
Thank you

cld