You are here

function filebrowser_form in Filebrowser 6.2

Same name and namespace in other branches
  1. 7.4 filebrowser.module \filebrowser_form()
  2. 7.2 filebrowser.module \filebrowser_form()
  3. 7.3 filebrowser.module \filebrowser_form()

Implementation of hook_form().

File

./filebrowser.module, line 90

Code

function filebrowser_form(&$node, $form_state) {
  $form['old_path'] = array(
    '#type' => 'hidden',
    '#value' => isset($node->folder_path) ? $node->folder_path : '',
  );
  $parts_weight = -10;
  $rights = isset($node->folder_rights) ? (object) $node->folder_rights : NULL;
  $presentation = isset($node->folder_presentation) ? (object) $node->folder_presentation : NULL;
  $uploads = isset($node->folder_uploads) ? (object) $node->folder_uploads : NULL;
  $file_handlers = isset($node->file_handlers) ? (object) $node->file_handlers : NULL;
  $type = node_get_types('type', $node);

  /** Folder description
   * *************************************************************** */
  $form['folder_description'] = array(
    /*    '#type' => 'fieldset',
        '#title' => t('Folder Description'),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,*/
    '#weight' => $parts_weight++,
  );
  $form['folder_description']['title'] = array(
    '#type' => 'textfield',
    '#title' => check_plain($type->title_label),
    '#default_value' => !empty($node->title) ? $node->title : '',
    '#required' => TRUE,
  );
  $form['folder_description']['folder_path'] = array(
    '#type' => 'textfield',
    '#title' => t('The system file path to the directory'),
    '#description' => t('This can be an absolute path or should be relative to the Drupal root directory.'),
    '#default_value' => isset($node->folder_path) ? $node->folder_path : '',
    '#required' => TRUE,
  );
  if (module_exists('token')) {
    $form['folder_description']['token_help'] = array(
      '#title' => t('Replacement patterns'),
      '#type' => 'fieldset',
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
    );
    $form['folder_description']['token_help']['help'] = array(
      '#value' => theme('token_help', 'node'),
    );
  }
  $form['folder_description']['body_filter']['body'] = array(
    '#type' => 'textarea',
    '#title' => t('Description'),
    '#description' => t("This will overide metainformations from .bbs or .ion files."),
    '#default_value' => $node->body,
    '#rows' => 5,
  );
  $form['folder_description']['body_filter']['format'] = filter_form($node->format);
  $form += _filebrowser_form_presentation_part($presentation, $parts_weight++);
  $form += _filebrowser_form_rights_part($rights, $parts_weight++);
  $form += _filebrowser_form_uploads_part($uploads, $parts_weight++);
  $form += _filebrowser_form_file_handlers_part($file_handlers, $parts_weight++);
  return $form;
}