← All changes
|
admin/section/class-convertkit-admin-section-general.php
+38
-2
3.3.8
→
3.4.3
View file →
| @@ -43,10 +43,10 @@ | ||
| 43 | 43 | // Define the settings key. |
| 44 | 44 | $this->settings_key = $this->settings::SETTINGS_NAME; |
| 45 | 45 | |
| 46 | 46 | // Define the programmatic name, Title and Tab Text. |
| 47 | - $this->name = 'general'; | |
| 48 | - $this->title = __( 'General Settings', 'convertkit' ); | |
| 47 | + $this->name = $this->settings->get_name(); | |
| 48 | + $this->title = $this->settings->get_title(); | |
| 49 | 49 | $this->tab_text = __( 'General', 'convertkit' ); |
| 50 | 50 | |
| 51 | 51 | // Define settings sections. |
| 52 | 52 | $this->settings_sections = array( |
| @@ -77,8 +77,9 @@ | ||
| 77 | 77 | // Register and maybe output notices for this settings screen, and the Intercom messenger. |
| 78 | 78 | if ( $this->on_settings_screen( $this->name ) ) { |
| 79 | 79 | add_filter( 'convertkit_settings_base_register_notices', array( $this, 'register_notices' ) ); |
| 80 | 80 | add_action( 'convertkit_settings_base_render_before', array( $this, 'maybe_output_notices' ) ); |
| 81 | + add_action( 'convertkit_settings_base_render_before', array( $this, 'maybe_output_legacy_form_notice' ) ); | |
| 81 | 82 | } |
| 82 | 83 | |
| 83 | 84 | // Enqueue scripts and CSS. |
| 84 | 85 | add_action( 'convertkit_admin_settings_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
| @@ -106,8 +107,43 @@ | ||
| 106 | 107 | array( |
| 107 | 108 | 'oauth2_success' => __( 'Successfully authorized with Kit.', 'convertkit' ), |
| 108 | 109 | ) |
| 109 | 110 | ); |
| 111 | + | |
| 112 | + } | |
| 113 | + | |
| 114 | + /** | |
| 115 | + * Outputs a non-dismissible warning when one or more Default Form settings | |
| 116 | + * reference Legacy Forms. | |
| 117 | + * | |
| 118 | + * @since 3.3.9 | |
| 119 | + */ | |
| 120 | + public function maybe_output_legacy_form_notice() { | |
| 121 | + | |
| 122 | + // Get warnings. | |
| 123 | + $warnings = WP_ConvertKit()->get_class( 'admin_legacy_resource_notice' )->get_legacy_warnings_for_plugin_settings( $this->settings->get() ); | |
| 124 | + | |
| 125 | + // Bail if no warnings are found. | |
| 126 | + if ( empty( $warnings ) ) { | |
| 127 | + return; | |
| 128 | + } | |
| 129 | + | |
| 130 | + // Output warnings. | |
| 131 | + ?> | |
| 132 | + <div id="convertkit-legacy-settings-warning" class="notice notice-warning"> | |
| 133 | + <p> | |
| 134 | + <strong><?php esc_html_e( 'Kit', 'convertkit' ); ?>:</strong> | |
| 135 | + <?php esc_html_e( 'Your Default Form settings reference Legacy Forms. They still work, but should be migrated:', 'convertkit' ); ?> | |
| 136 | + </p> | |
| 137 | + <ul> | |
| 138 | + <?php | |
| 139 | + foreach ( $warnings as $warning ) { | |
| 140 | + echo '<li>' . esc_html( $warning ) . '</li>'; | |
| 141 | + } | |
| 142 | + ?> | |
| 143 | + </ul> | |
| 144 | + </div> | |
| 145 | + <?php | |
| 110 | 146 | |
| 111 | 147 | } |
| 112 | 148 | |
| 113 | 149 | /** |