3 final class PhabricatorEditEngineConfigurationDefaultCreateController
4 extends PhabricatorEditEngineController
{
6 public function handleRequest(AphrontRequest
$request) {
7 $viewer = $this->getViewer();
9 $config = $this->loadConfigForEdit();
11 return id(new Aphront404Response());
14 $engine_key = $config->getEngineKey();
15 $key = $config->getIdentifier();
16 $cancel_uri = "/transactions/editengine/{$engine_key}/view/{$key}/";
18 $type = PhabricatorEditEngineDefaultCreateTransaction
::TRANSACTIONTYPE
;
20 if ($request->isFormPost()) {
23 $xactions[] = id(new PhabricatorEditEngineConfigurationTransaction())
24 ->setTransactionType($type)
25 ->setNewValue(!$config->getIsDefault());
27 $editor = id(new PhabricatorEditEngineConfigurationEditor())
29 ->setContentSourceFromRequest($request)
30 ->setContinueOnMissingFields(true)
31 ->setContinueOnNoEffect(true);
33 $editor->applyTransactions($config, $xactions);
35 return id(new AphrontRedirectResponse())
36 ->setURI($cancel_uri);
39 if ($config->getIsDefault()) {
40 $title = pht('Unmark as Create Form');
42 'Unmark this form as a create form? It will still function properly, '.
43 'but no longer be reachable directly from the application "Create" '.
45 $button = pht('Unmark Form');
47 $title = pht('Mark as Create Form');
49 'Mark this form as a create form? It will appear in the application '.
50 '"Create" menus by default.');
51 $button = pht('Mark Form');
54 return $this->newDialog()
56 ->appendParagraph($body)
57 ->addSubmitButton($button)
58 ->addCancelbutton($cancel_uri);