You are here

function elf_menu in External Links Filter 5

Same name and namespace in other branches
  1. 5.3 elf.module \elf_menu()
  2. 5.2 elf.module \elf_menu()
  3. 6.3 elf.module \elf_menu()
  4. 6.2 elf.module \elf_menu()
  5. 7.3 elf.module \elf_menu()

Implementation of hook_menu().

File

./elf.module, line 6

Code

function elf_menu($may_cache) {
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/elf',
      'title' => t('External links filter'),
      'description' => t('Configure External links filter'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'elf_admin_settings',
      ),
      'access' => user_access('administer site configuration'),
    );
  }
  else {
    if (variable_get('elf_css', TRUE)) {
      $path = drupal_get_path('module', 'elf');
      drupal_add_css($path . '/elf.css');
    }
    if (variable_get('elf_window', FALSE)) {
      drupal_add_js('
        $(document).ready(function() {
          // find all external links and set target to new window
          $("a.external-link").attr("target", "_blank");
        });
      ', 'inline');
    }
  }
  return $items;
}