Elementor\DB::save_editor PHP Метод

save_editor() публичный Метод

Save builder method.
С версии: 1.0.0
public save_editor ( integer $post_id, array $posted, string $revision = self::REVISION_PUBLISH ) : void
$post_id integer
$posted array
$revision string
Результат void
    public function save_editor($post_id, $posted, $revision = self::REVISION_PUBLISH)
    {
        // Change the global post to current library post, so widgets can use `get_the_ID` and other post data
        if (isset($GLOBALS['post'])) {
            $global_post = $GLOBALS['post'];
        }
        $GLOBALS['post'] = get_post($post_id);
        $editor_data = $this->_get_editor_data($posted);
        // We need the `wp_slash` in order to avoid the unslashing during the `update_post_meta`
        $json_value = wp_slash(wp_json_encode($editor_data));
        if (self::REVISION_PUBLISH === $revision) {
            $this->remove_draft($post_id);
            update_post_meta($post_id, '_elementor_data', $json_value);
            $this->_save_plain_text($post_id);
        } else {
            update_post_meta($post_id, '_elementor_draft_data', $json_value);
        }
        update_post_meta($post_id, '_elementor_version', self::DB_VERSION);
        // Restore global post
        if (isset($global_post)) {
            $GLOBALS['post'] = $global_post;
        } else {
            unset($GLOBALS['post']);
        }
    }