You are here

function filefield_menu in FileField 5.2

Same name and namespace in other branches
  1. 5 filefield.module \filefield_menu()
  2. 6.3 filefield.module \filefield_menu()
  3. 6.2 filefield.module \filefield_menu()

File

./filefield.module, line 13
Defines a file field type.

Code

function filefield_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    $items[] = array(
      'path' => 'filefield/js',
      'callback' => 'filefield_js',
      //'access' => user_access(),
      'access' => TRUE,
      'type' => MENU_CALLBACK,
    );
  }
  else {
    if ($_SESSION['filefield']) {

      // Add handlers for previewing new uploads.
      foreach ($_SESSION['filefield'] as $fieldname => $files) {
        if (is_array($files)) {
          foreach ($files as $delta => $file) {
            if ($file['preview']) {
              $items[] = array(
                'path' => $file['preview'],
                'callback' => '_filefield_preview',
                'access' => TRUE,
                'type' => MENU_CALLBACK,
              );
            }
          }
        }
      }
    }
  }
  return $items;
}