Differential D13999 Diff 33826 src/applications/dashboard/paneltype/PhabricatorDashboardTextPanelType.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/dashboard/paneltype/PhabricatorDashboardTextPanelType.php
| Show All 31 Lines | final class PhabricatorDashboardTextPanelType | ||||
| } | } | ||||
| public function renderPanelContent( | public function renderPanelContent( | ||||
| PhabricatorUser $viewer, | PhabricatorUser $viewer, | ||||
| PhabricatorDashboardPanel $panel, | PhabricatorDashboardPanel $panel, | ||||
| PhabricatorDashboardPanelRenderingEngine $engine) { | PhabricatorDashboardPanelRenderingEngine $engine) { | ||||
| $text = $panel->getProperty('text', ''); | $text = $panel->getProperty('text', ''); | ||||
| $oneoff = id(new PhabricatorMarkupOneOff())->setContent($text); | |||||
| $field = 'default'; | |||||
| $text_content = PhabricatorMarkupEngine::renderOneObject( | // NOTE: We're taking extra steps here to prevent creation of a text panel | ||||
| id(new PhabricatorMarkupOneOff())->setContent($text), | // which embeds itself using `{Wnnn}`, recursing indefinitely. | ||||
| 'default', | |||||
| $viewer); | $parent_key = PhabricatorDashboardRemarkupRule::KEY_PARENT_PANEL_PHIDS; | ||||
| $parent_phids = $engine->getParentPanelPHIDs(); | |||||
| $parent_phids[] = $panel->getPHID(); | |||||
| $markup_engine = id(new PhabricatorMarkupEngine()) | |||||
| ->setViewer($viewer) | |||||
| ->setContextObject($panel) | |||||
| ->setAuxiliaryConfig($parent_key, $parent_phids); | |||||
| $text_content = $markup_engine | |||||
| ->addObject($oneoff, $field) | |||||
| ->process() | |||||
| ->getOutput($oneoff, $field); | |||||
| return id(new PHUIPropertyListView()) | return id(new PHUIPropertyListView()) | ||||
| ->addTextContent($text_content); | ->addTextContent($text_content); | ||||
| } | } | ||||
| } | } | ||||