@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
at upstream/main 55 lines 1.6 kB view raw
1<?php 2 3final class PhabricatorEditEngineConfigurationSaveController 4 extends PhabricatorEditEngineController { 5 6 public function handleRequest(AphrontRequest $request) { 7 $engine_key = $request->getURIData('engineKey'); 8 $this->setEngineKey($engine_key); 9 10 $key = $request->getURIData('key'); 11 $viewer = $this->getViewer(); 12 13 $config = id(new PhabricatorEditEngineConfigurationQuery()) 14 ->setViewer($viewer) 15 ->withEngineKeys(array($engine_key)) 16 ->withIdentifiers(array($key)) 17 ->executeOne(); 18 if (!$config) { 19 return id(new Aphront404Response()); 20 } 21 22 $view_uri = $config->getURI(); 23 24 if ($config->getID()) { 25 return $this->newDialog() 26 ->setTitle(pht('Already Editable')) 27 ->appendParagraph( 28 pht('This form configuration is already editable.')) 29 ->addCancelButton($view_uri); 30 } 31 32 if ($request->isFormPost()) { 33 $editor = id(new PhabricatorEditEngineConfigurationEditor()) 34 ->setActor($viewer) 35 ->setContentSourceFromRequest($request) 36 ->setContinueOnNoEffect(true); 37 38 $editor->applyTransactions($config, array()); 39 40 return id(new AphrontRedirectResponse()) 41 ->setURI($config->getURI()); 42 } 43 44 // TODO: Explain what this means in more detail once the implications are 45 // more clear, or just link to some docs or something. 46 47 return $this->newDialog() 48 ->setTitle(pht('Make Builtin Editable')) 49 ->appendParagraph( 50 pht('Make this builtin form editable?')) 51 ->addSubmitButton(pht('Make Editable')) 52 ->addCancelButton($view_uri); 53 } 54 55}