示例#1
0
 /**
  * Responds to events for saving file metadata
  *
  * @param   Hubzero\Filesystem\File  $file      The file to which the metadata pertains
  * @param   array                    $metadata  The metadata itself
  * @return  void
  **/
 public function onMetadataSave(Hubzero\Filesystem\File $file, $metadata)
 {
     foreach ($metadata as $key => $value) {
         if (!$file->isLocal()) {
             return false;
         }
         $metadata = Metadata::oneOrNewByPathAndKey($file->getAbsolutePath(), $key);
         $metadata->set('value', (string) $value)->save();
     }
 }