Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / settings / setting / PhabricatorEditorSetting.php
blobbafc2ae518ff97e20868914957d8bdc04c6efb1e
1 <?php
3 final class PhabricatorEditorSetting
4 extends PhabricatorStringSetting {
6 const SETTINGKEY = 'editor';
8 public function getSettingName() {
9 return pht('Editor Link');
12 public function getSettingPanelKey() {
13 return PhabricatorExternalEditorSettingsPanel::PANELKEY;
16 protected function getSettingOrder() {
17 return 300;
20 protected function getControlInstructions() {
21 return pht(
22 "Many text editors can be configured as URI handlers for special ".
23 "protocols like `editor://`. If you have installed and configured ".
24 "such an editor, some applications can generate links that you can ".
25 "click to open files locally.".
26 "\n\n".
27 "Provide a URI pattern for building external editor URIs in your ".
28 "environment. For example, if you use TextMate on macOS, the pattern ".
29 "for your machine may look something like this:".
30 "\n\n".
31 "```name=\"Example: TextMate on macOS\"\n".
32 "%s\n".
33 "```\n".
34 "\n\n".
35 "For complete instructions on editor configuration, ".
36 "see **[[ %s | %s ]]**.".
37 "\n\n".
38 "See the tables below for a list of supported variables and protocols.",
39 'txmt://open/?url=file:///Users/alincoln/editor_links/%n/%f&line=%l',
40 PhabricatorEnv::getDoclink('User Guide: Configuring an External Editor'),
41 pht('User Guide: Configuring an External Editor'));
44 public function validateTransactionValue($value) {
45 if (!phutil_nonempty_string($value)) {
46 return;
49 id(new PhabricatorEditorURIEngine())
50 ->setPattern($value)
51 ->validatePattern();