You are here

function lightbox2_contact in Lightbox2 8

Same name and namespace in other branches
  1. 5.2 lightbox2.module \lightbox2_contact()
  2. 6 lightbox2.module \lightbox2_contact()
  3. 7.2 lightbox2.module \lightbox2_contact()
  4. 7 lightbox2.module \lightbox2_contact()

Get the contact form.

1 string reference to 'lightbox2_contact'
lightbox2_menu in ./lightbox2.module
Implementation of hook_menu().

File

./lightbox2.module, line 1634
Enables the use of lightbox2 which places images above your current page, not within. This frees you from the constraints of the layout, particularly column widths.

Code

function lightbox2_contact() {
  if (\Drupal::moduleHandler()
    ->moduleExists('contact') && \Drupal::config('lightbox2.settings')
    ->get('lightbox2_enable_contact') && \Drupal::currentUser()
    ->hasPermission('access site-wide contact form')) {
    $path = drupal_get_path('module', 'contact');
    include_once $path . '/contact.pages.inc';
    print \Drupal::service("renderer")
      ->render(\Drupal::formBuilder()
      ->getForm('contact_site_form'));

    // drupal_add_js() with 'inline' didn't seem to work, possibly because this is
    // AJAX loaded content.
    print '<script type="text/javascript">Drupal.attachBehaviors();</script>';
    exit;
  }
}