Zurb Foundation Reveal Modals with Drupal 7

Last modified
Sunday, February 12, 2017 - 07:36

Foundation is one of the latest and most popular responsive frameworks available on the Web nowadays, quite easy to use, fast to learn, the documentation section is really useful and there is also a Drupal version of this framework included as a base theme so you can take good advantage of Foundation in Drupal.

Zurb Foundation is the Drupal base theme that implements this nice framework and offers a lot of advantages for example, creating Modal windows with Foundation is a pretty straight forward task and the base theme makes this task way easier on Drupal by providing a theme hook in order to properly render a Modal in you HTML.

The hook is called  zurb_foundation_reveal and returns an html link.

theme('zurb_foundation_reveal', array(
  'text' => t('Text'), // element that triggers the modal; by default this theme function returns a link
  'path' => url('node/3'), //only available if ajax is true
  'ajax' => TRUE, /false if not an ajax call; use it with 'path'
  'html' => TRUE, //HTML permitted or false
  'reveal' => '', // HTML content to render; not needed when ajax is true
));

Use this hook to render whatever content you want into a Foundation Modal, it can be a AJAX call response too what you insert on the Modal jut remember to use JSON. To see more about the available options see the Foundation documentation for Reveal Modals.

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.