public function save_post_type () {
    global $mf_domain;

    //checking the nonce
    check_admin_referer('form_post_type_posttype');

    //saving the posttype
    if(isset($_POST['mf_posttype'])){
      //check posttype_id
      $mf = $_POST['mf_posttype'];
      if($mf['core']['id']){
        $this->update_post_type($mf);
      }else{
        if($this->new_posttype($mf)){
          //redirect to dashboard
        }else{
          //reload form and show warning
        }
      }
      $name = trim($mf['option']['capability_type']);
      if( !in_array($name,array('post','page')) && !empty($name) ){
        //register capabilities for admin
        $this->_add_cap($name);
      }

    }
		$this->mf_redirect("mf_posttype","update_rewrite",array("noheader" => "true"));
  }