diff --git a/eightshift-forms.php b/eightshift-forms.php index 68672aa8..b2ae9272 100644 --- a/eightshift-forms.php +++ b/eightshift-forms.php @@ -6,7 +6,7 @@ * Description: Eightshift Forms is a complete form builder plugin that utilizes modern Block editor features with multiple third-party integrations, bringing your project to a new level. * Author: WordPress team @Infinum * Author URI: https://eightshift.com/ - * Version: 4.0.117 + * Version: 4.0.118 * Text Domain: eightshift-forms * * @package EightshiftForms diff --git a/src/Hooks/Filters.php b/src/Hooks/Filters.php index 5aa7bb3b..9fb913a4 100644 --- a/src/Hooks/Filters.php +++ b/src/Hooks/Filters.php @@ -473,7 +473,6 @@ class Filters 'twoToThreeGeneral', 'twoToThreeForms', 'twoToThreeLocale', - 'twoToThreeLabels', ], ]; diff --git a/src/Migration/SettingsMigration.php b/src/Migration/SettingsMigration.php index 1fbfb10b..0e95baa9 100644 --- a/src/Migration/SettingsMigration.php +++ b/src/Migration/SettingsMigration.php @@ -60,11 +60,6 @@ class SettingsMigration implements SettingGlobalInterface, ServiceInterface */ public const VERSION_2_3_LOCALE = '2-3-locale'; - /** - * Version 2-3 labels key. - */ - public const VERSION_2_3_LABELS = '2-3-labels'; - /** * Register all the hooks * @@ -171,26 +166,6 @@ public function getSettingsGlobalData(): array ], ], ], - [ - 'component' => 'divider', - 'dividerExtraVSpacing' => true, - ], - [ - 'component' => 'card-inline', - 'cardInlineTitle' => \__('Version 2 → Version 3 - labels', 'eightshift-forms'), - 'cardInlineSubTitle' => \__('Small changes to field labels.', 'eightshift-forms'), - 'cardInlineRightContent' => [ - [ - 'component' => 'submit', - 'submitValue' => \__('Migrate', 'eightshift-forms'), - 'submitVariant' => 'ghost', - 'submitAttrs' => [ - Helper::getStateAttribute('migrationType') => self::VERSION_2_3_LABELS, - ], - 'additionalClass' => Helper::getStateSelectorAdmin('migration'), - ], - ], - ], ], ], [ diff --git a/src/Rest/Routes/Settings/MigrationRoute.php b/src/Rest/Routes/Settings/MigrationRoute.php index c5565dda..68f1e2b7 100644 --- a/src/Rest/Routes/Settings/MigrationRoute.php +++ b/src/Rest/Routes/Settings/MigrationRoute.php @@ -146,8 +146,6 @@ public function routeCallback(WP_REST_Request $request) return $this->getMigration2To3Forms(); case SettingsMigration::VERSION_2_3_LOCALE: return $this->getMigration2To3Locale(); - case SettingsMigration::VERSION_2_3_LABELS: - return $this->getMigration2To3Labels(); default: return $this->getApiErrorOutput( \__('Migration version type key was not provided or not valid.', 'eightshift-forms'), @@ -519,66 +517,4 @@ private function getMigration2To3Locale(): array $output ); } - - /** - * Migration version 2-3 labels. - * - * @return array - */ - private function getMigration2To3Labels(): array - { - $output = []; - - $theQuery = new WP_Query([ - 'post_type' => Forms::POST_TYPE_SLUG, - 'no_found_rows' => true, - 'update_post_term_cache' => false, - 'post_status' => 'any', - 'nopaging' => true, - 'posts_per_page' => 5000, // phpcs:ignore WordPress.WP.PostsPerPage.posts_per_page_posts_per_page - ]); - - // Fields to update. - $fields = [ - 'inputInputFieldHideLabel', - 'textareaTextareaFieldHideLabel', - 'countryCountryFieldHideLabel', - 'dateDateFieldHideLabel', - 'phonePhoneFieldHideLabel', - 'selectSelectFieldHideLabel', - ]; - - $forms = $theQuery->posts; - \wp_reset_postdata(); - - if ($forms) { - foreach ($forms as $form) { - $formId = (int) $form->ID; - $content = $form->post_content; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps - - if (!$formId || !$content) { - continue; - } - - foreach ($fields as $field) { - $content = \str_replace("\"{$field}\":true", "\"{$field}\":false", $content); - } - - $output[] = \wp_update_post([ - 'ID' => $formId, - 'post_content' => $content, - ]); - } - } - - $actionName = Filters::getFilterName(['migration', 'twoToThreeLabels']); - if (\has_action($actionName)) { - \do_action($actionName, SettingsMigration::VERSION_2_3_LABELS); - } - - return $this->getApiSuccessOutput( - \__('Migration version 2 to 3 labels finished with success.', 'eightshift-forms'), - $output - ); - } } diff --git a/testFilters/testFilters.php b/testFilters/testFilters.php index eb9482fe..af5e4cb6 100644 --- a/testFilters/testFilters.php +++ b/testFilters/testFilters.php @@ -109,7 +109,6 @@ public function register(): void // Validation actions. 'es_forms_migration_two_to_three_general' => ['runMigration2To3General'], 'es_forms_migration_two_to_three_forms' => ['runMigration2To3Forms'], - 'es_forms_migration_two_to_three_labels' => ['runMigration2To3Labels'], 'es_forms_migration_two_to_three_locale' => ['runMigration2To3Locale'], // --------------------------------------------------------------------------------------------------------- ]; @@ -914,14 +913,4 @@ public function runMigration2To3Locale(): void { error_log(print_r(('Action hook activated 2-3 locale'), true)); // phpcs:ignore } - - /** - * Run custom action after migration from verson 2 to 3 - labels. - * - * @return void - */ - public function runMigration2To3Labels(): void - { - error_log(print_r(('Action hook activated 2-3 labels'), true)); // phpcs:ignore - } }