CreateFormRoute.php
2 years ago
EditFormRoute.php
2 years ago
RegisterFormBuilderPageRoute.php
2 years ago
RegisterFormBuilderRestRoutes.php
2 years ago
EditFormRoute.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\FormBuilder\Routes; |
| 4 | |
| 5 | use Give\FormBuilder\FormBuilderRouteBuilder; |
| 6 | use Give\Helpers\Form\Utils; |
| 7 | |
| 8 | /** |
| 9 | * Route to edit an existing form |
| 10 | */ |
| 11 | class EditFormRoute |
| 12 | { |
| 13 | /** |
| 14 | * @since 3.0.3 Use isV3Form() method instead of 'post_content' to check if the form is built with Visual Builder |
| 15 | * @since 3.0.0 |
| 16 | * |
| 17 | * @return void |
| 18 | */ |
| 19 | public function __invoke() |
| 20 | { |
| 21 | if (isset($_GET['post'], $_GET['action']) && 'edit' === $_GET['action']) { |
| 22 | $post = get_post(abs($_GET['post'])); |
| 23 | if ('give_forms' === $post->post_type && Utils::isV3Form($post->ID)) { |
| 24 | wp_redirect(FormBuilderRouteBuilder::makeEditFormRoute($post->ID)); |
| 25 | exit(); |
| 26 | } |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 |