public function save($storage = null)
{
if ($storage == null) {
$storage = $this->storage;
}
if (is_string($storage)) {
$storage = explode(':', $storage, 2);
switch (count($storage)) {
case 2:
list($type, $location) = $storage;
break;
default:
return;
}
}
switch ($type) {
case 'silo':
// TODO
// Get silo by path $location
// Create a MediaAsset based on $_FILES[$this->name]['tmp_name']
break;
case 'path':
move_uploaded_file($_FILES[$this->field]['tmp_name'], $location . '/' . basename($_FILES[$this->field]['name']));
break;
/* TODO is there any use for any of these ?
case 'user':
User::identify()->info->{$location} = $this->value;
break;
case 'option':
Options::set( $location, $this->value );
break;
case 'action':
Plugins::filter($location, $this->value, $this->name, true);
break;
case 'formstorage':
$storage->field_save( $this->name, $this->value );
break;
*/
/* TODO is there any use for any of these ?
case 'user':
User::identify()->info->{$location} = $this->value;
break;
case 'option':
Options::set( $location, $this->value );
break;
case 'action':
Plugins::filter($location, $this->value, $this->name, true);
break;
case 'formstorage':
$storage->field_save( $this->name, $this->value );
break;
*/
case 'null':
break;
}
}