/**
* @param null $id
* @throws \Exception
*/
public function getById($id = null)
{
if (!$id) {
$id = $this->model->getId();
}
$layoutRaw = $this->db->fetchRow("SELECT * FROM custom_layouts WHERE id = ?", $id);
if ($layoutRaw["id"]) {
$this->assignVariablesToModel($layoutRaw);
$this->model->setLayoutDefinitions($this->getLayoutData());
} else {
throw new \Exception("Layout with ID " . $id . " doesn't exist");
}
}