Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phriction/markup/PhrictionRemarkupRule.php
Show First 20 Lines • Show All 267 Lines • ▼ Show 20 Lines | final class PhrictionRemarkupRule extends PhutilRemarkupRule { | ||||
private function getRelativeBaseURI() { | private function getRelativeBaseURI() { | ||||
$context = $this->getEngine()->getConfig('contextObject'); | $context = $this->getEngine()->getConfig('contextObject'); | ||||
if (!$context) { | if (!$context) { | ||||
return null; | return null; | ||||
} | } | ||||
// Handle content when it's a preview for the Phriction editor. | |||||
if (is_array($context)) { | |||||
if (idx($context, 'phriction.isPreview')) { | |||||
return idx($context, 'phriction.slug'); | |||||
} | |||||
} | |||||
if ($context instanceof PhrictionContent) { | if ($context instanceof PhrictionContent) { | ||||
return $context->getSlug(); | return $context->getSlug(); | ||||
} | } | ||||
if ($context instanceof PhrictionDocument) { | if ($context instanceof PhrictionDocument) { | ||||
return $context->getContent()->getSlug(); | return $context->getContent()->getSlug(); | ||||
} | } | ||||
return null; | return null; | ||||
0: Should this fail loudly instead, or are the above possibilities not meant to be exhaustive? | |||||
} | } | ||||
} | } |
Should this fail loudly instead, or are the above possibilities not meant to be exhaustive?