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