base-source.php
2 years ago
preset-source-post.php
2 years ago
preset-source-query-var.php
2 years ago
preset-source-user.php
2 years ago
preset-source-query-var.php
30 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace Jet_Form_Builder\Presets\Sources; |
| 5 | |
| 6 | // If this file is called directly, abort. |
| 7 | if ( ! defined( 'WPINC' ) ) { |
| 8 | die; |
| 9 | } |
| 10 | |
| 11 | class Preset_Source_Query_Var extends Base_Source { |
| 12 | |
| 13 | public function get_id() { |
| 14 | return 'query_var'; |
| 15 | } |
| 16 | |
| 17 | public function query_source() { |
| 18 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 19 | return $_GET; |
| 20 | } |
| 21 | |
| 22 | public function get_prop() { |
| 23 | return ! empty( $this->field_data['other']['query_var'] ) ? $this->field_data['other']['query_var'] : ''; |
| 24 | } |
| 25 | |
| 26 | public function get_result_on_prop() { |
| 27 | return isset( $this->src()[ $this->prop ] ) ? $this->src()[ $this->prop ] : null; |
| 28 | } |
| 29 | } |
| 30 |