Create a new page (and initial page version)
public updatePage ( integer $pageId, array $post = [], boolean $publish = false, boolean | null $raw = null, boolean $cache = false ) : boolean | ||
$pageId | integer | |
$post | array | |
$publish | boolean | (This is set to FALSE by the Landing if the permission check fails) |
$raw | boolean | null | |
$cache | boolean | |
return | boolean |
/** * Create a new page in the current directory * * @param int $pageId * @param array $post * @param string $cabin * @param string $dir * @return mixed */ 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; }