From 73d6355d4117dc9964a5ddaf5daf1359c70cee93 Mon Sep 17 00:00:00 2001 From: JR Tashjian Date: Sun, 30 Jun 2024 01:07:48 -0400 Subject: [PATCH] Don't create default forms anymore --- .../BlockLibraryServiceProvider.php | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/includes/BlockLibrary/BlockLibraryServiceProvider.php b/includes/BlockLibrary/BlockLibraryServiceProvider.php index 3f464f6..19de6a1 100644 --- a/includes/BlockLibrary/BlockLibraryServiceProvider.php +++ b/includes/BlockLibrary/BlockLibraryServiceProvider.php @@ -42,7 +42,6 @@ public function register(): void {} * @return void */ public function boot(): void { - add_action( 'wp_loaded', array( $this, 'activation' ) ); add_action( 'init', array( $this, 'register_blocks' ) ); add_action( 'init', array( $this, 'register_patterns' ) ); @@ -50,45 +49,6 @@ public function boot(): void { add_filter( 'block_type_metadata_settings', array( $this, 'update_layout_support' ), 10, 2 ); } - /** - * Create the default forms. - */ - public function activation() { - if ( ! get_transient( 'omniform_just_activated' ) ) { - return; - } - - $existing_forms = get_posts( - array( - 'post_status' => 'any', - 'post_type' => 'omniform', - ) - ); - - if ( ! empty( $existing_forms ) ) { - return; - } - - /** @var \OmniForm\FormTypes\FormTypesManager */ // phpcs:ignore - $form_types_manager = $this->getContainer()->get( FormTypesManager::class ); - - foreach ( $this->get_block_patterns() as $form ) { - wp_insert_post( - array( - 'post_type' => 'omniform', - 'post_status' => 'draft', - 'post_name' => $form['name'], - 'post_title' => $form['title'], - 'post_content' => $form['content'], - 'tax_input' => array( - 'omniform_type' => $form_types_manager->validate_form_type( $form['type'] ?? '' ), - ), - 'meta_input' => $form['meta'] ?? array(), - ) - ); - } - } - /** * Get an array of block patterns from the BlockPatterns/ directory,. *