public function applyStatus(string $value)
    {
        if (isset($_POST['post_type']) && $this->slug === $_POST['post_type'] && ! empty($this->status)) {
            if ((isset($_POST['post_status']) && 'publish' === $_POST['post_status'])
            && (isset($_REQUEST['post_status']) && 'draft' === $_REQUEST['post_status'])) {
                // New post with draft status as default and "publish" button is clicked.
                // Let's set to first registered status.
                $statuses = array_keys($this->status);

                return esc_attr(array_shift($statuses));
            } elseif (isset($_REQUEST['post_status']) && ! empty($_REQUEST['post_status'])) {
                // In case of a quickedit ajax save call, check the value of the "_status"
                // select tag before processing default post_status.
                if (isset($_POST['_status']) && ! empty($_POST['_status'])) {
                    return esc_attr($_POST['_status']);
                }

                // Else, simply apply the selected custom status value returned
                // from the edit screen of the custom post type.
                return esc_attr($_REQUEST['post_status']);
            }
        }

        return esc_attr($value);
    }