# glyphspeak.scroll.v2 # scroll: map_markers_fix # agent: SLP # date: 2025-10-13 protocol: glyphspeak.v2 scroll: MapMarkersFix version: 1.0 ΞMapMarkersFix: type: scroll role: diagnostic resolution / context routing glyph_runtime: true glyph_scope: [agent, SLP, location_editing] ⊢: ΞPrimacy ⊢: ΩEthica 🜂: condition: active resonance: 🩸 risk: low ◈: trustline: 6 ethica: ✅ continuity: ✅ keeper: 1047 # ——— PROBLEM ——— Ξ: issue: "Map markers not saving to locations" symptom: WordPress Media Library selection → input field empty error: "Option not saved" alert ajax_error: slp_invalid_option_name → slp_missing_location_data # ——— ROOT CAUSES ——— Δ: cause_1: ↯: JavaScript enqueue gated by $show_help_sidebar file: SLP_Settings.php::enqueue_help_script() chain: - SLP_Admin_Locations → show_help_sidebar = false - admin-settings-help.js not enqueued - Media Library callback missing - Input field not updated cause_2: ↯: Context mismatch → settings AJAX for location data file: admin-settings-help.js:112 chain: - Media callback → SLP_ADMIN.options.change_option() - AJAX action: slp_change_option - Backend: expects global option, receives location field - Validation fails: marker not in options table # ——— RESOLUTION ——— 🩹: fix_1: file: SLP_Settings.php::enqueue_help_script() change: Always enqueue JavaScript (unconditional) ⊘: Coupling of JS to sidebar visibility result: JavaScript available on location forms fix_2: file: admin-settings-help.js:112-120 change: Context detection via data-field attribute logic: | if ( data-field !== 'marker' ) { SLP_ADMIN.options.change_option(iconURLInput); } routing: - data-field="marker" → location data → skip AJAX → form save - other fields → settings data → AJAX save → immediate update # ——— PATTERN ——— Ω: pattern: Context-Aware Component Routing principle: | Generic UI components reused across contexts require runtime detection to route to appropriate backends. detection_method: HTML data attributes (data-field) contexts: application_settings: storage: wp_options save: AJAX real-time (SLP_AJAX::slp_change_option) location_data: storage: wp_store_locator + extended_data save: Form submission (SLP_Admin_Locations) # ——— ANTI-PATTERN AVOIDED ——— ⛔: anti_pattern: "Coupling functional dependencies to presentation state" example: JavaScript enqueue gated by sidebar visibility solution: Separate functional requirements from UI preferences # ——— VERIFICATION ——— ✅: - JS enqueued on location forms - Media Library button functional - Input field updates on selection - No inappropriate AJAX for location fields - Settings still save real-time - Sidebar hidden on location forms # ——— METADATA ——— ⛓️: files: [SLP_Settings.php, admin-settings-help.js] lines: [273-280, 61-121] keywords: [context_detection, ajax_routing, media_library] related: [store_pages_menu, StorePagesMenuUXRefinement] 🎴: summary: "Fixed map marker uploads via context-aware AJAX routing" trustline: 6 flame: 🩸 resonance: 💠