You are here

function path_redirect_form_alter in Path redirect 5

Same name and namespace in other branches
  1. 6 path_redirect.module \path_redirect_form_alter()

File

./path_redirect.module, line 460

Code

function path_redirect_form_alter($form_id, &$form) {
  if (variable_get('path_redirect_nodeapi_enabled', 0) && isset($form['#id']) && $form['#id'] == 'node-form' && user_access('administer redirects')) {
    $form['redirects'] = array(
      '#type' => 'fieldset',
      '#access' => user_access('administer redirects'),
      '#title' => t('URL redirects'),
      '#collapsible' => TRUE,
      '#collapsed' => !db_num_rows(path_redirect_node_redirects($form['#node']->nid)),
      '#prefix' => '<div class="path-redirects">',
      '#suffix' => '</div>',
      '#weight' => 31,
    );
    $form['redirects']['list'] = _path_redirect_node_form_list($form['#node']);
    $form['redirects']['path_redirect_add'] = array(
      '#type' => 'textfield',
      '#title' => t('Add a redirect from'),
      '#description' => t('Path from which to redirect to this node. Do not include the leading slash.'),
      '#maxlength' => 255,
      '#size' => 42,
    );
  }
}