coordinates = $coordinates; } /** * Hooks the source up. */ public function register(): void { add_filter( 'mapsemble_location_sources', static function ( array $sources ): array { $sources[ MapConfig::SOURCE_META_KEYS ] = __( 'Custom fields (latitude/longitude meta keys)', 'mapsemble' ); return $sources; } ); add_action( 'mapsemble_map_form_location_fields', array( $this, 'render_key_fields' ) ); // Priority 20, mirroring the ACF hook: after whatever wrote the // source meta for this save has finished. add_action( 'save_post', array( $this, 'mirror_on_save' ), 20 ); } /** * Renders the two key inputs in the map config form. * * @param MapConfig $config The config being edited. */ public function render_key_fields( MapConfig $config ): void { // The data attribute lets the edit screen script disable and hide // the inputs while another source is chosen; without the script // they stay usable. ?>