function saveSections() { $sections = $_POST['sections']; $updated = $_POST['updated']; $pageId = $_POST['pageId']; $response = []; $section = array_key_exists($updated, $sections) ? $sections[$updated] : false; //TODO: Improve this onepager()->section()->save($pageId, $sections); if ($section) { $response["content"] = onepager()->render()->section($section); $response["style"] = onepager()->render()->style($section); } $response["success"] = true; //TODO: better response op_send_json($response); }
public function reloadBlocks() { $blocks = array_values(onepager()->blockManager()->all()); $success = true; op_send_json(compact('success', 'blocks')); }