| @@ -149,9 +149,12 @@ | ||
| 149 | 149 | * @param object $action Form action object. |
| 150 | 150 | * @return string |
| 151 | 151 | */ |
| 152 | 152 | public static function get_action_type( $action ) { |
| 153 | - return $action->post_content['success_action'] ?? self::get_default_action_type(); | |
| 153 | + if ( isset( $action->post_content['success_action'] ) ) { | |
| 154 | + return $action->post_content['success_action']; | |
| 155 | + } | |
| 156 | + return self::get_default_action_type(); | |
| 154 | 157 | } |
| 155 | 158 | |
| 156 | 159 | public static function get_default_action_type() { |
| 157 | 160 | return 'message'; |
| @@ -224,13 +227,13 @@ | ||
| 224 | 227 | |
| 225 | 228 | return; |
| 226 | 229 | } |
| 227 | 230 | |
| 228 | - $form_options[ $opt . 'action' ] = $action->post_content['success_action'] ?? 'message'; | |
| 231 | + $form_options[ $opt . 'action' ] = isset( $action->post_content['success_action'] ) ? $action->post_content['success_action'] : 'message'; | |
| 229 | 232 | |
| 230 | 233 | switch ( $form_options[ $opt . 'action' ] ) { |
| 231 | 234 | case 'redirect': |
| 232 | - $form_options[ $opt . 'url' ] = $action->post_content['success_url'] ?? ''; | |
| 235 | + $form_options[ $opt . 'url' ] = isset( $action->post_content['success_url'] ) ? $action->post_content['success_url'] : ''; | |
| 233 | 236 | $form_options['open_in_new_tab'] = ! empty( $action->post_content['open_in_new_tab'] ); |
| 234 | 237 | $form_options['redirect_delay'] = ! empty( $action->post_content['redirect_delay'] ); |
| 235 | 238 | $form_options['redirect_delay_time'] = $action->post_content['redirect_delay_time']; |
| 236 | 239 | $form_options['redirect_delay_msg'] = $action->post_content['redirect_delay_msg']; |
| @@ -236,9 +239,9 @@ | ||
| 236 | 239 | $form_options['redirect_delay_msg'] = $action->post_content['redirect_delay_msg']; |
| 237 | 240 | break; |
| 238 | 241 | |
| 239 | 242 | case 'page': |
| 240 | - $form_options[ $opt . 'page_id' ] = $action->post_content['success_page_id'] ?? ''; | |
| 243 | + $form_options[ $opt . 'page_id' ] = isset( $action->post_content['success_page_id'] ) ? $action->post_content['success_page_id'] : ''; | |
| 241 | 244 | break; |
| 242 | 245 | |
| 243 | 246 | default: |
| 244 | 247 | $form_options[ $opt . 'msg' ] = ! empty( $action->post_content['success_msg'] ) ? $action->post_content['success_msg'] : self::get_default_msg(); |
| @@ -329,22 +332,22 @@ | ||
| 329 | 332 | */ |
| 330 | 333 | private static function get_on_submit_action_data_from_form_options( $form_options, $event = 'create' ) { |
| 331 | 334 | $opt = 'update' === $event ? 'edit_' : 'success_'; |
| 332 | 335 | $data = array( |
| 333 | - 'success_action' => $form_options[ $opt . 'action' ] ?? self::get_default_action_type(), | |
| 336 | + 'success_action' => isset( $form_options[ $opt . 'action' ] ) ? $form_options[ $opt . 'action' ] : self::get_default_action_type(), | |
| 334 | 337 | ); |
| 335 | 338 | |
| 336 | 339 | switch ( $data['success_action'] ) { |
| 337 | 340 | case 'redirect': |
| 338 | - $data['success_url'] = $form_options[ $opt . 'url' ] ?? ''; | |
| 341 | + $data['success_url'] = isset( $form_options[ $opt . 'url' ] ) ? $form_options[ $opt . 'url' ] : ''; | |
| 339 | 342 | break; |
| 340 | 343 | |
| 341 | 344 | case 'page': |
| 342 | - $data['success_page_id'] = $form_options[ $opt . 'page_id' ] ?? ''; | |
| 345 | + $data['success_page_id'] = isset( $form_options[ $opt . 'page_id' ] ) ? $form_options[ $opt . 'page_id' ] : ''; | |
| 343 | 346 | break; |
| 344 | 347 | |
| 345 | 348 | default: |
| 346 | - $data['success_msg'] = $form_options[ $opt . 'msg' ] ?? self::get_default_msg(); | |
| 349 | + $data['success_msg'] = isset( $form_options[ $opt . 'msg' ] ) ? $form_options[ $opt . 'msg' ] : self::get_default_msg(); | |
| 347 | 350 | $data['show_form'] = ! empty( $form_options['show_form'] ); |
| 348 | 351 | } |
| 349 | 352 | |
| 350 | 353 | return $data; |