assets
1 year ago
block-asset.php
1 year ago
block-parser.php
1 year ago
block-render.php
1 year ago
block-template.php
1 year ago
block-type.php
1 year ago
block.json
1 year ago
tools.php
1 year ago
block-parser.php
41 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | namespace JFB_Compatibility\Jet_Engine\Blocks\Map_Field; |
| 5 | |
| 6 | use Jet_Form_Builder\Exceptions\Parse_Exception; |
| 7 | use JFB_Modules\Block_Parsers\Field_Data_Parser; |
| 8 | use JFB_Modules\Block_Parsers\Fields\Default_Parser; |
| 9 | use JFB_Modules\Block_Parsers\Interfaces\Multiple_Parsers; |
| 10 | |
| 11 | // If this file is called directly, abort. |
| 12 | if ( ! defined( 'WPINC' ) ) { |
| 13 | die; |
| 14 | } |
| 15 | |
| 16 | class Block_Parser extends Field_Data_Parser implements Multiple_Parsers { |
| 17 | |
| 18 | /** |
| 19 | * @return mixed |
| 20 | */ |
| 21 | public function type() { |
| 22 | return 'map-field'; |
| 23 | } |
| 24 | |
| 25 | public function generate_parsers(): \Generator { |
| 26 | $lat_parser = new Default_Parser(); |
| 27 | $lat_parser->set_context( $this->get_context() ); |
| 28 | $lng_parser = clone $lat_parser; |
| 29 | |
| 30 | $lat_parser->set_type( 'map-field-lat' ); |
| 31 | $lng_parser->set_type( 'map-field-lng' ); |
| 32 | |
| 33 | $lat_parser->set_name( $this->name . '_lat' ); |
| 34 | $lng_parser->set_name( $this->name . '_lng' ); |
| 35 | |
| 36 | yield $lat_parser; |
| 37 | yield $lng_parser; |
| 38 | } |
| 39 | |
| 40 | } |
| 41 |