You are here

function filebrowser_form_rename in Filebrowser 7.3

Same name and namespace in other branches
  1. 7.4 filebrowser.module \filebrowser_form_rename()

File rename form. CHECK: $node is used but not defined in this function

1 string reference to 'filebrowser_form_rename'
filebrowser_page_rename in ./filebrowser.pages.inc

File

./filebrowser.module, line 944

Code

function filebrowser_form_rename($form, &$form_state, $fids) {

  // Store original items.
  $original_files = array();

  // Array of textboxes with new names.
  $form['new_names'] = array(
    '#tree' => TRUE,
  );
  foreach ($fids as $fid) {
    $content = _filebrowser_node_content_load($fid);
    $node = node_load($content['nid']);
    $name = _filebrowser_safe_basename($content['path']);
    $path = _filebrowser_encoding_to_fs($node, _filebrowser_get_node_root($node) . $content['root']);
    $original_files[$fid] = array(
      'path' => $path,
      'display-name' => $name,
      'full-path' => $path . '/' . $name,
    );
    $form['new_names'][$fid] = array(
      '#type' => 'textfield',
      '#default_value' => $name,
    );
  }

  // Store original names into form values.
  $form['original_files'] = array(
    '#type' => 'value',
    '#value' => $original_files,
  );
  return confirm_form($form, t('Rename selected items...'), isset($_GET['destination']) ? $_GET['destination'] : 'node/' . $node->nid, t('This action cannot be undone.'), t('Rename'), t('Cancel'));
}