Context
Same source as #115 — mining a client production-restructure project's Epic A retrospective. LinkField
records were the second-most common reason a BuildTask was needed instead of content-api.
The gap
SilverStripe\LinkField\Models\Link and its subclasses (SiteTreeLink, EmailLink,
ExternalLink, etc.) have zero content-api surface — not even a read path via the schema/records
endpoints, as far as this project's exploration found. Every nav link, footer link, CTA card
link, or hero-slide button link needs a BuildTask:
// Temp05NavTask.php — utility nav / footer nav
$link = SiteTreeLink::create();
$link->LinkText = $add['title'];
$link->PageID = $page->ID;
$link->OwnerID = $aboutGroup->ID;
$link->OwnerClass = NavigationGroup::class;
$link->OwnerRelation = 'NavigationLinks';
$link->write();
This compounds with #115 (Elemental content) — most LinkField records on a typical Elemental
site are owned by an Element (a CTA card's link, a hero slide's link), so fixing #115 alone
still leaves the link itself unreachable.
Ask
Expose Link/SiteTreeLink to api_writable_fields/api_writable_relations the same way any
polymorphic-owner DataObject is exposed. The OwnerID/OwnerClass/OwnerRelation polymorphic
pattern is presumably the main design question — worth scoping whether a generic polymorphic-owner
write path is a bigger ask than this issue alone, or whether Link can just declare
content_api_access like any other class and be written via OwnerID/OwnerClass as plain
writable fields, same as any other has_one FK.
Context
Same source as #115 — mining a client production-restructure project's Epic A retrospective. LinkField
records were the second-most common reason a BuildTask was needed instead of content-api.
The gap
SilverStripe\LinkField\Models\Linkand its subclasses (SiteTreeLink,EmailLink,ExternalLink, etc.) have zero content-api surface — not even a read path via the schema/recordsendpoints, as far as this project's exploration found. Every nav link, footer link, CTA card
link, or hero-slide button link needs a BuildTask:
This compounds with #115 (Elemental content) — most
LinkFieldrecords on a typical Elementalsite are owned by an Element (a CTA card's link, a hero slide's link), so fixing #115 alone
still leaves the link itself unreachable.
Ask
Expose
Link/SiteTreeLinktoapi_writable_fields/api_writable_relationsthe same way anypolymorphic-owner
DataObjectis exposed. TheOwnerID/OwnerClass/OwnerRelationpolymorphicpattern is presumably the main design question — worth scoping whether a generic polymorphic-owner
write path is a bigger ask than this issue alone, or whether
Linkcan just declarecontent_api_accesslike any other class and be written viaOwnerID/OwnerClassas plainwritable fields, same as any other has_one FK.