map-tools.php
58 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace JFB_Compatibility\Jet_Engine\Blocks; |
| 5 | |
| 6 | // If this file is called directly, abort. |
| 7 | if ( ! defined( 'WPINC' ) ) { |
| 8 | die; |
| 9 | } |
| 10 | |
| 11 | class Map_Tools { |
| 12 | |
| 13 | const STRING = 'location_string'; |
| 14 | const ARRAY = 'location_array'; |
| 15 | const ADDRESS = 'location_address'; |
| 16 | |
| 17 | public static function get_formats(): array { |
| 18 | return array( |
| 19 | array( |
| 20 | 'value' => self::STRING, |
| 21 | 'label' => __( 'String', 'jet-form-builder' ), |
| 22 | 'title' => __( 'String with location Lat and Lng separated by coma', 'jet-form-builder' ), |
| 23 | ), |
| 24 | array( |
| 25 | 'value' => self::ARRAY, |
| 26 | 'label' => __( 'Array', 'jet-form-builder' ), |
| 27 | 'title' => __( 'Array with location Lat and Lng', 'jet-form-builder' ), |
| 28 | ), |
| 29 | array( |
| 30 | 'value' => self::ADDRESS, |
| 31 | 'label' => __( 'Address', 'jet-form-builder' ), |
| 32 | 'title' => __( 'Location Address', 'jet-form-builder' ), |
| 33 | ), |
| 34 | ); |
| 35 | } |
| 36 | |
| 37 | public static function is_supported(): bool { |
| 38 | return ( |
| 39 | function_exists( 'jet_engine' ) && |
| 40 | version_compare( jet_engine()->get_version(), '3.0.3', '>=' ) && |
| 41 | jet_engine()->modules->is_module_active( 'maps-listings' ) |
| 42 | ); |
| 43 | } |
| 44 | |
| 45 | public static function get_help_message(): string { |
| 46 | return sprintf( |
| 47 | /* translators: %1$s - link to the JetEngine page, %2$s - link to the Map Listing tutorial */ |
| 48 | __( |
| 49 | '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.', |
| 50 | 'jet-form-builder' |
| 51 | ), |
| 52 | 'https://crocoblock.com/plugins/jetengine/', |
| 53 | 'https://crocoblock.com/knowledge-base/articles/jetengine-maps-listing-overview/' |
| 54 | ); |
| 55 | } |
| 56 | |
| 57 | } |
| 58 |