Airship\Cabin\Bridge\Landing\Blog::processEditPost PHP Method

processEditPost() protected method

Update a blog post
protected processEditPost ( array $post, array $authorsAllowed = [], array $oldPost = [] ) : boolean
$post array
$authorsAllowed array
$oldPost array
return boolean
    protected function processEditPost(array $post, array $authorsAllowed = [], array $oldPost = []) : bool
    {
        $required = ['author', 'blog_post_body', 'format', 'save_btn', 'title'];
        if (!\Airship\all_keys_exist($required, $post)) {
            return false;
        }
        if (!$this->isSuperUser()) {
            if (!empty($post['author'])) {
                // Only administrators can transfer ownership; block this request
                return false;
            }
            if (!\in_array((int) $oldPost['author'], $authorsAllowed)) {
                // This author is invalid.
                return false;
            }
        }
        $publish = $this->can('publish') ? $post['save_btn'] === 'publish' : false;
        return $this->blog->updatePost($post, $oldPost, $publish);
    }