path_admin_form

6 path.admin.inc path_admin_form(&$form_state, $edit = array('src' => '', 'dst' => '', 'language' => '', 'pid' => NULL))
7 path.admin.inc path_admin_form($form, &$form_state, $path = array('source' => '', 'alias' => '', 'language' => LANGUAGE_NONE, 'pid' => NULL))
8 path.admin.inc path_admin_form($form, &$form_state, $path = array('source' => '', 'alias' => '', 'langcode' => LANGUAGE_NOT_SPECIFIED, 'pid' => NULL))

Return a form for editing or creating an individual URL alias.

See also

path_admin_form_validate()

path_admin_form_submit()

Related topics

2 string references to 'path_admin_form'

File

modules/path/path.admin.inc, line 86
Administrative page callbacks for the path module.

Code

function path_admin_form(&$form_state, $edit = array('src' => '', 'dst' => '', 'language' => '', 'pid' => NULL)) {

  $form['#alias'] = $edit;

  $form['src'] = array(
    '#type' => 'textfield', 
    '#title' => t('Existing system path'), 
    '#default_value' => $edit['src'], 
    '#maxlength' => 128, 
    '#size' => 45, 
    '#description' => t('Specify the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1+2.'), 
    '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='), 
    '#required' => TRUE,
  );
  $form['dst'] = array(
    '#type' => 'textfield', 
    '#title' => t('Path alias'), 
    '#default_value' => $edit['dst'], 
    '#maxlength' => 128, 
    '#size' => 45, 
    '#description' => t('Specify an alternative path by which this data can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'), 
    '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='), 
    '#required' => TRUE,
  );
  // This will be a hidden value unless locale module is enabled
  $form['language'] = array(
    '#type' => 'value', 
    '#value' => $edit['language'],
  );
  if ($edit['pid']) {
    $form['pid'] = array(
      '#type' => 'hidden',
      '#value' => $edit['pid'],
    );
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Update alias'),
    );
  }
  else {
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Create new alias'),
    );
  }

  return $form;
}
Login or register to post comments