Skip to content

Add location, remove address, link and URL sniffing #195

Description

@edalzell

Second half of #190, and the breaking change that cuts 7.0.

location becomes a declared text field holding a place — either a plain description ("Outside the side exit") or an address ("123 Main St, Surrey, BC"). RFC 5545 LOCATION is free text, so both are the same shape and one field covers them. location is also what RFC 5545, the Google Calendar API, MS Graph and schema.org all call it, which is why address goes away rather than the other way round.

Warning

Blocked on transformstudios/prime#834. Statamic's Fields::resolveFields() does ->keyBy->handle(), so duplicate handles collapse silently, last import wins. Today Events declares no location and Prime owns the handle uncontested. The moment this lands, any blueprint importing both prime::location and events::event has two location fields and one loses its data.

Field

resources/fieldsets/event.yaml, in the Location section from #193:

  • locationtype: text, localizable: true, instructions covering both the plain-description and address cases

localizable: true because the text needs translating, unlike the shared online_url.

Resolution

src/Types/Event.php:

  • icsLocation()location, falling back to online_url when location is empty
  • delete icsAddress() and eventUrl(), the address handle, and the Str::isUrl sniff from icsUrl()icsUrl() becomes just online_url
  • read via $this->event->get() throughout, rather than today's mix of raw get() and augmented __get
  • keep an is_string() guard on location: a blueprint can always override the field type, and a TypeError on a public route is the worst failure mode. A non-string value is ignored silently, never fatal, and the addon never reaches into nested shapes — computed values stay the documented escape hatch for custom shapes.

Mapping

Event LOCATION: URL:
Physical only location
Online only online_url online_url
Hybrid location online_url

The fallback row is the point of the whole design: it's what makes an online-only event's join link clickable in Apple Calendar and auto-detected by Fantastical, with no vendor-specific properties.

Tests

TDD — write these failing first.

  • each row of the mapping table, across all four download routes
  • non-string location is ignored rather than fatal — collapse Only pass string addresses to ICS downloads #184's three near-identical group-location tests (lines 200, 257, 283) into this one invariant, which is what they were really asserting
  • address is no longer read
  • link is no longer read
  • a URL in location is treated as a location, not a URL — the sniff is gone

Docs

  • rewrite the field table from Reconcile the contradicting ICS field docs #191 for the new contract
  • include the mapping table above, and state that location and online_url are independent and combinable
  • remove address and link
  • document that a non-string location is skipped, and point at computed values for custom shapes
  • start the 7.0 upgrade notes: the renames and what they mean for existing content (the automated migration lands separately)

Branch

feature/location-field off main. Needs #193.

Part of #190.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions