Differential D21241 Diff 50588 src/applications/system/controller/PhabricatorSystemSelectViewAsController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/system/controller/PhabricatorSystemSelectViewAsController.php
| Show All 12 Lines | public function handleRequest(AphrontRequest $request) { | ||||
| if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
| $result = array('engine' => $v_engine); | $result = array('engine' => $v_engine); | ||||
| return id(new AphrontAjaxResponse())->setContent($result); | return id(new AphrontAjaxResponse())->setContent($result); | ||||
| } | } | ||||
| $engines = PhabricatorDocumentEngine::getAllEngines(); | $engines = PhabricatorDocumentEngine::getAllEngines(); | ||||
| $options = $request->getStrList('options'); | |||||
| $options = array_fuse($options); | |||||
| // TODO: This controller isn't very good because the valid options depend | // TODO: This controller is a bit rough because it isn't really using the | ||||
| // on the file being rendered and most of them can't even diff anything, | // file ref to figure out which engines should work. See also T13513. | ||||
| // and this ref is completely bogus. | // Callers can pass a list of "options" to control which options are | ||||
| // presented, at least. | |||||
| // For now, we just show everything. | |||||
| $ref = new PhabricatorDocumentRef(); | $ref = new PhabricatorDocumentRef(); | ||||
| $map = array(); | $map = array(); | ||||
| foreach ($engines as $engine) { | foreach ($engines as $engine) { | ||||
| $key = $engine->getDocumentEngineKey(); | $key = $engine->getDocumentEngineKey(); | ||||
| if ($options && !isset($options[$key])) { | |||||
| continue; | |||||
| } | |||||
| $label = $engine->getViewAsLabel($ref); | $label = $engine->getViewAsLabel($ref); | ||||
| if (!strlen($label)) { | if (!strlen($label)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| $map[$key] = $label; | $map[$key] = $label; | ||||
| } | } | ||||
| Show All 24 Lines | |||||