map-tools.php
52 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace Jet_Form_Builder\Compatibility\Jet_Engine\Blocks; |
| 5 | |
| 6 | class Map_Tools { |
| 7 | |
| 8 | const STRING = 'location_string'; |
| 9 | const ARRAY = 'location_array'; |
| 10 | const ADDRESS = 'location_address'; |
| 11 | |
| 12 | public static function get_formats(): array { |
| 13 | return array( |
| 14 | array( |
| 15 | 'value' => self::STRING, |
| 16 | 'label' => __( 'String', 'jet-form-builder' ), |
| 17 | 'title' => __( 'String with location Lat and Lng separated by coma', 'jet-form-builder' ), |
| 18 | ), |
| 19 | array( |
| 20 | 'value' => self::ARRAY, |
| 21 | 'label' => __( 'Array', 'jet-form-builder' ), |
| 22 | 'title' => __( 'Array with location Lat and Lng', 'jet-form-builder' ), |
| 23 | ), |
| 24 | array( |
| 25 | 'value' => self::ADDRESS, |
| 26 | 'label' => __( 'Address', 'jet-form-builder' ), |
| 27 | 'title' => __( 'Location Address', 'jet-form-builder' ), |
| 28 | ), |
| 29 | ); |
| 30 | } |
| 31 | |
| 32 | public static function is_supported(): bool { |
| 33 | return ( |
| 34 | function_exists( 'jet_engine' ) && |
| 35 | version_compare( jet_engine()->get_version(), '3.0.3', '>=' ) && |
| 36 | jet_engine()->modules->is_module_active( 'maps-listings' ) |
| 37 | ); |
| 38 | } |
| 39 | |
| 40 | public static function get_help_message(): string { |
| 41 | return sprintf( |
| 42 | __( |
| 43 | 'The Map Field type requires both the <a href="%1$s">JetEngine</a> (3.0.3) plugin and its <a href="%2$s">Map Listing</a> feature to be activated.', |
| 44 | 'jet-form-builder' |
| 45 | ), |
| 46 | 'https://crocoblock.com/plugins/jetengine/', |
| 47 | 'https://crocoblock.com/knowledge-base/articles/jetengine-maps-listing-overview/' |
| 48 | ); |
| 49 | } |
| 50 | |
| 51 | } |
| 52 |