@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
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix a type issue with FormView juggling

Summary:
When you click the pencil icon in the Maniphest task list, we currently fatal:

Argument 1 passed to PhabricatorCustomFieldList::appendFieldsToForm() must be an instance of AphrontFormView, instance of PHUIFormLayoutView given, called in /core/lib/phabricator/src/applications/maniphest/controller/ManiphestTaskEditController.php on line 576 and defined

This is because we build an `AphrontFormView` noramlly, but a `PHUIFormLayoutView` for dialogs, since they don't take a full form (they render their own form tag).

Instead, always build an `AphrontFormView` and just pull the `PHUIFormLayoutView` out of it when we're ready to put it in a dialog. This means `$form` is always the same type of object, and is generally better and makes more sense.

Test Plan: Clicked pencil edit icon in Maniphest task list.

Reviewers: btrahan, chad

Reviewed By: btrahan

CC: aran, carl

Differential Revision: https://secure.phabricator.com/D8324

+13 -13
+5 -9
src/applications/maniphest/controller/ManiphestTaskEditController.php
··· 460 460 461 461 $project_tokenizer_id = celerity_generate_unique_node_id(); 462 462 463 - if ($request->isAjax()) { 464 - $form = new PHUIFormLayoutView(); 465 - } else { 466 - $form = new AphrontFormView(); 467 - $form 468 - ->setUser($user) 469 - ->addHiddenInput('template', $template_id); 470 - } 463 + $form = new AphrontFormView(); 464 + $form 465 + ->setUser($user) 466 + ->addHiddenInput('template', $template_id); 471 467 472 468 if ($parent_task) { 473 469 $form ··· 627 623 ->appendChild( 628 624 array( 629 625 $error_view, 630 - $form, 626 + $form->buildLayoutView(), 631 627 )) 632 628 ->addCancelButton($cancel_uri) 633 629 ->addSubmitButton($button_name);
+8 -4
src/view/form/AphrontFormView.php
··· 81 81 $this->getUser())); 82 82 } 83 83 84 - public function render() { 85 - 86 - require_celerity_resource('phui-form-view-css'); 87 - $layout = id (new PHUIFormLayoutView()) 84 + public function buildLayoutView() { 85 + return id(new PHUIFormLayoutView()) 88 86 ->appendChild($this->renderDataInputs()) 89 87 ->appendChild($this->renderChildren()); 88 + } 89 + 90 + public function render() { 91 + require_celerity_resource('phui-form-view-css'); 92 + 93 + $layout = $this->buildLayoutView(); 90 94 91 95 if (!$this->user) { 92 96 throw new Exception(pht('You must pass the user to AphrontFormView.'));