You are here

function xmlsitemap_modal_xmlsitemap_operation_link_alter in XML sitemap 6.2

Same name and namespace in other branches
  1. 7.2 xmlsitemap_modal/xmlsitemap_modal.module \xmlsitemap_modal_xmlsitemap_operation_link_alter()

Implements hook_xmlsitemap_operation_link_alter().

File

xmlsitemap_modal/xmlsitemap_modal.module, line 51

Code

function xmlsitemap_modal_xmlsitemap_operation_link_alter(array &$link) {
  static $ctools_modal_included;

  // Process modal frame links.
  if (!empty($link['modal'])) {
    unset($link['modal']);
    if (!isset($ctools_modal_included)) {

      // Only process a few includes once per request.
      ctools_include('ajax');
      ctools_include('modal');
      ctools_modal_add_js();
      drupal_add_css(drupal_get_path('module', 'xmlsitemap_modal') . '/xmlsitemap_modal.css');
    }
    $link['attributes']['class'] = 'ctools-use-modal';
    if (strpos($link['href'], 'nojs') === FALSE) {
      $link['href'] .= '/nojs';
    }
    else {
      $link['href'] = trim($link['href'], '/');
    }

    // @todo Remove when http://drupal.org/node/565808 is fixed.
    if (substr($link['href'], -4) === 'nojs') {
      $link['href'] .= '/';
    }
  }
}