protected function processEditPage(int $pageId, array $post = [], string $cabin = '', string $dir = '') : bool
{
$required = ['format', 'page_body', 'save_btn', 'metadata'];
if (!\Airship\all_keys_exist($required, $post)) {
return false;
}
if ($this->isSuperUser()) {
$raw = !empty($post['raw']);
} else {
$raw = null;
// Don't set
}
$cache = !empty($post['cache']);
if ($this->can('publish')) {
$publish = $post['save_btn'] === 'publish';
} elseif ($this->can('update')) {
$publish = false;
} else {
$this->storeLensVar('post_response', ['message' => \__('You do not have permission to edit pages.'), 'status' => 'error']);
return false;
}
if ($this->pg->updatePage($pageId, $post, $publish, $raw, $cache)) {
\Airship\redirect($this->airship_cabin_prefix . '/pages/' . $cabin, ['dir' => $dir]);
}
return true;
}