Add overlay View to any page or path

Mon, 02/27/2012 - 13:28 -- meladawy

Drupal come with a great Overlay Module which make you able to display your pages in overlay view,I wonder when i see a lot of drupal developers uses another Jquery libraries such as Fancybox, Lightbox, ShadowBox...etc, Anyway overlay View is usually limited for administration pages, So in order to make our visitors access our pages in overlay view we should tell drupal "Hey Drupal !! This page is for administrators"  ;-) (okkk i know we lie !!) :-#

Lets make our visitors access our contact page in overlay view, in order to make this we should tell drupal that the path "http://www.example.com/contact" is for administrators (we lie again) by Implementing hook_admin_paths_alter . , Lets go !!

1- First you have to Change the overlay permissions and make the overlay view accessed by Visitors and users
change overlay permission

2- lets Implement Hook_admin_path_alter

/**
* Implementation of hook_admin_paths_alter().
*/
function drupalst_admin_paths_alter(&$path) {
	$path['contact'] = TRUE;  
}	

You can Implement Implement multiple paths

/**
* Implementation of hook_admin_paths_alter().
*/
function drupalst_admin_paths_alter(&$path) {
	$path['contact'] = TRUE;  
        $path['node/20'] = TRUE;  
        $path['feed'] = TRUE;  
        $path['about-us'] = TRUE;  
}	

Now when your visitors Click on Contact Button, they will see your contact form in overlay view
contact page in overlay view

Good Luck.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.