src/admin/class-papi-admin.php
public function update_front_page( $value, $option ) {
		if ( $option !== 'page_on_front' ) {
			return $value;
		}

		$front_pages = papi_get_all_entry_types( [
			'types' => ['front-page'],
		] );

		if ( count( $front_pages ) === 0 ) {
			return $value;
		}

		$old_page_type_id = papi_get_page_type_id( $value );
		$new_page_type_id = $front_pages[0]->get_id();

		// Delete all old fields from old page type if any.
		if ( strtolower( $old_page_type_id ) !== strtolower( $new_page_type_id ) ) {
			if ( $page_type = papi_get_entry_type_by_id( $old_page_type_id ) ) {
				$slugs = array_map( function( $property ) {
					return $property->get_slug( true );
				}, $page_type->get_properties() );

				foreach ( $slugs as $slug ) {
					papi_delete_field( $value, $slug );
				}
			}
		}

		papi_set_page_type_id( $value, $new_page_type_id );

		return $value;
	}
public function update_front_page( $value, $option ) {
		if ( $option !== 'page_on_front' ) {
			return $value;
		}

		$front_pages = papi_get_all_entry_types( [
			'types' => ['front-page'],
		] );

		if ( count( $front_pages ) === 0 ) {
			return $value;
		}

		$old_page_type_id = papi_get_page_type_id( $value );
		$new_page_type_id = $front_pages[0]->get_id();

		// Delete all old fields from old page type if any.
		if ( strtolower( $old_page_type_id ) !== strtolower( $new_page_type_id ) ) {
			if ( $page_type = papi_get_entry_type_by_id( $old_page_type_id ) ) {
				$slugs = array_map( function( $property ) {
					return $property->get_slug( true );
				}, $page_type->get_properties() );

				foreach ( $slugs as $slug ) {
					papi_delete_field( $value, $slug );
				}
			}
		}

		papi_set_page_type_id( $value, $new_page_type_id );

		return $value;
	}
Update page type to front page type when updating
which page that should be used as front page.

@param  mixed  $value
@param  string $option

@return mixed