You are here

function extlink_menu in External Links 5

Same name and namespace in other branches
  1. 6 extlink.module \extlink_menu()
  2. 7 extlink.module \extlink_menu()

File

./extlink.module, line 3

Code

function extlink_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'admin/settings/extlink',
      'title' => t('External links'),
      'description' => t('Alter the display of external links on the site.'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'extlink_admin_settings',
      ),
      'access' => user_access('administer site configuration'),
    );
  }
  else {
    $path = drupal_get_path('module', 'extlink');
    drupal_add_js($path . '/extlink.js');
    drupal_add_js(array(
      'extlink' => array(
        'extTarget' => variable_get('extlink_target', 0),
        'extClass' => variable_get('extlink_class', 'ext'),
        'extSubdomains' => variable_get('extlink_subdomains', 1),
        'extExclude' => variable_get('extlink_exclude', ''),
        'extInclude' => variable_get('extlink_include', ''),
        'extAlert' => variable_get('extlink_alert', 0),
        'extAlertText' => variable_get('extlink_alert_text', 'This link will take you to an external web site. We are not responsible for their content.'),
        'mailtoClass' => variable_get('extlink_mailto_class', 'mailto'),
      ),
    ), 'setting');
    if (variable_get('extlink_class', 'ext') == 'ext' || variable_get('extlink_mailto_class', 'mailto') == 'mailto') {
      drupal_add_css($path . '/extlink.css');
    }
  }
  return $items;
}