You are here

function noreferrer_admin in No Referrer 7

Admin settings form.

1 string reference to 'noreferrer_admin'
noreferrer_menu in ./noreferrer.module
Implements hook_menu().

File

./noreferrer.admin.inc, line 11
Admin settings callbacks for no referrer module.

Code

function noreferrer_admin() {
  $form['noreferrer_link'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add link types to code-generated links'),
    '#default_value' => variable_get('noreferrer_link', TRUE),
    '#description' => t('If checked, <code>rel="noopener"</code> and/or <code>rel="noreferrer"</code> will be added to links generated by code (e.g. menu items). Enabling this setting may have a negative impact on site performance because each link will be processed by the theme layer.'),
  );
  $form['noreferrer_noopener'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add <code>rel="noopener"</code> to links with a target'),
    '#default_value' => variable_get('noreferrer_noopener', TRUE),
    '#description' => t('If checked, the <code>rel="noopener"</code> link type will be added to links with a target attribute.'),
  );
  $form['noreferrer_noreferrer'] = array(
    '#type' => 'checkbox',
    '#title' => t('Add <code>rel="noreferrer"</code> to non-whitelisted links'),
    '#default_value' => variable_get('noreferrer_noreferrer', TRUE),
    '#description' => t('If checked, the <code>rel="noreferrer"</code> link type will be added to non-whitelisted external links.'),
  );
  $form['noreferrer_whitelisted_domains'] = array(
    '#type' => 'textfield',
    '#title' => t('Whitelisted domains'),
    '#default_value' => variable_get('noreferrer_whitelisted_domains', ''),
    '#description' => t('Enter a space-separated list of domains to which referrer URLs will be sent (e.g. <em>example.com example.org</em>). Links to all other domains will have a <code>rel="noreferrer"</code> attribute added.'),
    '#maxlength' => NULL,
  );
  $form['noreferrer_publish'] = array(
    '#type' => 'checkbox',
    '#title' => t('Publish list of whitelisted domains'),
    '#default_value' => variable_get('noreferrer_publish', FALSE),
    '#description' => t('If checked, the list of whitelisted domains will be published at <a href="@url">@url</a> when saving this form.', array(
      '@url' => file_create_url(noreferrer_publish_uri()),
    )),
  );
  $form['noreferrer_subscribe_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Subscribe to external list of whitelisted domains'),
    '#default_value' => variable_get('noreferrer_subscribe_url', ''),
    '#description' => t('If configured, the list of whitelisted domains will be retrieved from the given URL during each cron run.'),
  );
  $form = system_settings_form($form);
  $form['#submit'][] = 'noreferrer_admin_submit';
  return $form;
}