You are here

function masquerade_handler_field_user::options_form in Masquerade Extras 7.2

Same name and namespace in other branches
  1. 6.2 masquerade_views/handlers/masquerade_handler_field_user.inc \masquerade_handler_field_user::options_form()
  2. 6 masquerade_views/handlers/masquerade_handler_field_user.inc \masquerade_handler_field_user::options_form()
  3. 7 masquerade_views/handlers/masquerade_handler_field_user.inc \masquerade_handler_field_user::options_form()

Adds additional options to the Field options form

Overrides views_handler_field_user_link::options_form

File

masquerade_views/handlers/masquerade_handler_field_user.inc, line 34
Views field handler.

Class

masquerade_handler_field_user
Field handler that allows a link to be generated for a user so you may masquerade as them.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $form['masquerade_views'] = array(
    '#tree' => TRUE,
  );
  $form['masquerade_views']['custom_destination'] = array(
    '#title' => t('Provide a custom destination.'),
    '#description' => t('This is helpful for providing a shortcut to a certain function of the site from one area or another.'),
    '#type' => 'checkbox',
    '#default_value' => !empty($this->options['masquerade_views']['custom_destination']) ? $this->options['masquerade_views']['custom_destination'] : FALSE,
  );

  // Provide an optional redirect immediately after switching to another user
  $form['masquerade_views']['destination'] = array(
    '#title' => t('Alternate destination'),
    '#description' => t('Redirect the browser to this page immediately after switching to another user. There is a caveat, however. When you switch back, masquerade will not remember where you last were.'),
    '#type' => 'textfield',
    '#default_value' => !empty($this->options['masquerade_views']['destination']) && valid_url($this->options['masquerade_views']['destination']) ? $this
      ->sanitize_value($this->options['masquerade_views']['destination']) : '',
  );

  // Override the normal link-to title and description.
  $form['link_to_user']['#title'] = t('Generate a link to Masquerade as this user.');
  $form['link_to_user']['#description'] = t('Be careful not to rewrite this field with tokens that generate links. This field will only display a link to users who have permission to masquerade.');
}