src/PostType/PostType.php
protected function prepareStatus(string $status, array $args)
    {
        $this->status[$status] = $this->parseStatusArguments($status, $args);

        // Remove default publish metabox.
        $this->action->add('add_meta_boxes', function () {
            remove_meta_box('submitdiv', $this->slug, 'side');
        });

        // Apply selected status on save.
        $this->filter->add([
            'pre_post_status',
            'status_save_pre'
        ], [$this, 'applyStatus']);

        // Expose post type status for JS use.
        $this->filter->add('themosis_admin_global', function ($data) {
            $status['draft'] = $this->parseStatusArguments('draft', [
                'publish_text' => __('Save Draft')
            ]);

            $data['post_types'][$this->slug] = ['statuses' => array_merge($status, $this->status)];

            return $data;
        });

        // Reorder the list of statuses on the list table.
        // Put the "trash" item as the last one.
        $this->filter->add("views_edit-{$this->slug}", function ($views) {
            if (array_key_exists('trash', $views)) {
                $trash = $views['trash'];
                unset($views['trash']);
                end($views);
                $views['trash'] = $trash;
            }

            return $views;
        });
    }
protected function prepareStatus(string $status, array $args)
    {
        $this->status[$status] = $this->parseStatusArguments($status, $args);

        // Remove default publish metabox.
        $this->action->add('add_meta_boxes', function () {
            remove_meta_box('submitdiv', $this->slug, 'side');
        });

        // Apply selected status on save.
        $this->filter->add([
            'pre_post_status',
            'status_save_pre'
        ], [$this, 'applyStatus']);

        // Expose post type status for JS use.
        $this->filter->add('themosis_admin_global', function ($data) {
            $status['draft'] = $this->parseStatusArguments('draft', [
                'publish_text' => __('Save Draft')
            ]);

            $data['post_types'][$this->slug] = ['statuses' => array_merge($status, $this->status)];

            return $data;
        });

        // Reorder the list of statuses on the list table.
        // Put the "trash" item as the last one.
        $this->filter->add("views_edit-{$this->slug}", function ($views) {
            if (array_key_exists('trash', $views)) {
                $trash = $views['trash'];
                unset($views['trash']);
                end($views);
                $views['trash'] = $trash;
            }

            return $views;
        });
    }
protected function prepareStatus ( string $ status , array $ args ) { $ this -> status [ $ status ] = $ this -> parseStatusArguments ( $ status , $ args ) ; // Remove default publish metabox. $ this -> action -> add ( 'add_meta_boxes' , function ( ) { remove_meta_box ( 'submitdiv' , $ this -> slug , 'side' ) ; } ) ; // Apply selected status on save. $ this -> filter -> add ( [ 'pre_post_status' , 'status_save_pre' ] , [ $ this , 'applyStatus' ] ) ; // Expose post type status for JS use. $ this -> filter -> add ( 'themosis_admin_global' , function ( $ data ) { $ status [ 'draft' ] = $ this -> parseStatusArguments ( 'draft' , [ 'publish_text' => __ ( 'Save Draft' ) ] ) ; $ data [ 'post_types' ] [ $ this -> slug ] = [ 'statuses' => array_merge ( $ status , $ this -> status ) ] ; return $ data ; } ) ; // Reorder the list of statuses on the list table. // Put the "trash" item as the last one. $ this -> filter -> add ( "views_edit-{$this->slug}" , function ( $ views ) { if ( array_key_exists ( 'trash' , $ views ) ) { $ trash = $ views [ 'trash' ] ; unset ( $ views [ 'trash' ] ) ; end ( $ views ) ; $ views [ 'trash' ] = $ trash ; } return $ views ; } ) ; }
Register custom post type status.

@param string $status
@param array  $args
Register custom post type status .