You are here

function filebrowser_filebrowser_metadata_set in Filebrowser 7.3

Same name and namespace in other branches
  1. 8 filebrowser.module \filebrowser_filebrowser_metadata_set()
  2. 6.2 filebrowser.module \filebrowser_filebrowser_metadata_set()
  3. 7.4 filebrowser.module \filebrowser_filebrowser_metadata_set()
  4. 7.2 filebrowser.module \filebrowser_filebrowser_metadata_set()

File

./filebrowser.module, line 1273

Code

function filebrowser_filebrowser_metadata_set($file, $metadata) {
  $base_path = _filebrowser_safe_dirname($file['full-path']);
  $data = _filebrowser_load_description_file($base_path);
  if (!isset($data['file'])) {
    $data['file'] = "{$base_path}/descript.ion";
  }
  if ($metadata === NULL) {

    // Clear metadata for the given file.
    unset($data['data'][$file['display-name']]);
  }
  else {
    $data['data'][$file['display-name']] = $metadata['description'];
  }
  _filebrowser_save_description_file($data, $base_path);
  _filebrowser_load_description_file($base_path, $data);
}