* - 'backend://' (Back-end page-route for staff)
* - 'service://` (Web-service page-route for automated integrations; aka webhooks and IPNs)
* - 'current://' (Whichever UI is currently active)
+ * - 'default://'(Whichever UI is recorded in the metadata)
* - 'asset://' (Static asset-file; see \Civi::paths())
* - 'assetBuilder://' (Dynamically-generated asset-file; see \Civi\Core\AssetBuilder)
* - 'ext://' (Static asset-file provided by an extension)
}
if ($scheme === 'default') {
- // TODO Use metadata to pick $scheme = 'frontend' or 'backend' or 'service';
- throw new \RuntimeException("FIXME: Implement lookup for default ");
+ $scheme = \CRM_Core_Menu::isPublicRoute($this->getPath()) ? 'frontend' : 'backend';
}
switch ($scheme) {
// For purposes of this test, it doesn't matter if "current" is frontend or backend - as long as it's consistent.
}
+ public function testUrl_DefaultUI(): void {
+ $adminDefault = (string) \Civi::url('default://civicrm/admin');
+ $adminBackend = (string) \Civi::url('backend://civicrm/admin');
+ $this->assertEquals($adminBackend, $adminDefault, "civicrm/admin should default to backend");
+
+ $userDefault = (string) \Civi::url('default://civicrm/user');
+ $userBackend = (string) \Civi::url('frontend://civicrm/user');
+ $this->assertEquals($userBackend, $userDefault, "civicrm/user should default to frontend");
+ }
+
/**
* @param string $expectContentRegex
* @param string $url