You are here

function ctools_context_user_edit_form_settings_form in Chaos Tool Suite (ctools) 7

1 string reference to 'ctools_context_user_edit_form_settings_form'
user_edit_form.inc in plugins/contexts/user_edit_form.inc
Plugin to provide a user_edit_form context.

File

plugins/contexts/user_edit_form.inc, line 98
Plugin to provide a user_edit_form context.

Code

function ctools_context_user_edit_form_settings_form($form, &$form_state) {
  $conf =& $form_state['conf'];
  $form['user'] = array(
    '#title' => t('Enter the name or UID of a node'),
    '#type' => 'textfield',
    '#maxlength' => 512,
    '#autocomplete_path' => 'ctools/autocomplete/user',
    '#weight' => -10,
  );
  if (!empty($conf['uid'])) {
    $info = db_query('SELECT * FROM {users} WHERE uid = :uid', array(
      ':uid' => $conf['uid'],
    ))
      ->fetchObject();
    if ($info) {
      $link = l(t("'%name' [user id %uid]", array(
        '%name' => $info->name,
        '%uid' => $info->uid,
      )), "user/{$info->uid}", array(
        'attributes' => array(
          'target' => '_blank',
          'title' => t('Open in new window'),
        ),
        'html' => TRUE,
      ));
      $form['user']['#description'] = t('Currently set to !link', array(
        '!link' => $link,
      ));
    }
  }
  $form['uid'] = array(
    '#type' => 'value',
    '#value' => $conf['uid'],
  );
  $form['set_identifier'] = array(
    '#type' => 'checkbox',
    '#default_value' => FALSE,
    '#title' => t('Reset identifier to user name'),
    '#description' => t('If checked, the identifier will be reset to the user name of the selected user.'),
  );
  return $form;
}