@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorSystemSelectHighlightController
4 extends PhabricatorController {
5
6 public function shouldRequireLogin() {
7 return false;
8 }
9
10 public function processRequest() {
11 $request = $this->getRequest();
12
13 if ($request->isFormPost()) {
14 $result = array('highlight' => $request->getStr('highlight'));
15 return id(new AphrontAjaxResponse())->setContent($result);
16 }
17
18 $languages = array(
19 '' => pht('(Use Default)'),
20 ) + PhabricatorEnv::getEnvConfig('pygments.dropdown-choices');
21
22 $form = id(new AphrontFormView())
23 ->setUser($this->getRequest()->getUser())
24 ->appendRemarkupInstructions(pht('Choose a syntax highlighting to use.'))
25 ->appendChild(
26 id(new AphrontFormSelectControl())
27 ->setLabel(pht('Highlighting'))
28 ->setName('highlight')
29 ->setValue($request->getStr('highlight'))
30 ->setOptions($languages));
31
32 return $this->newDialog()
33 ->setTitle(pht('Select Syntax Highlighting'))
34 ->appendChild($form->buildLayoutView())
35 ->addSubmitButton(pht('Choose Highlighting'))
36 ->addCancelButton('/');
37 }
38}