public function setDataFromEditmode($data)
{
if ($data["type"]) {
$this->type = $data["type"];
}
if ($data["title"]) {
$this->title = $data["title"];
}
if ($data["description"]) {
$this->description = $data["description"];
}
// this is to be backward compatible to <= v 1.4.7
if ($data["id"]) {
$data["path"] = $data["id"];
}
$video = Asset::getByPath($data["path"]);
if ($video instanceof Asset\Video) {
$this->id = $video->getId();
} else {
$this->id = $data["path"];
}
$this->poster = null;
$poster = Asset::getByPath($data["poster"]);
if ($poster instanceof Asset\Image) {
$this->poster = $poster->getId();
}
return $this;
}