mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-10 23:01:04 +01:00
Minor, fix the PagedForm UIExample
Summary: A couple of features got added when this was used in Diffusion, but didn't get backported to the UIExample. See: <https://github.com/facebook/phabricator/issues/454> Auditors: btrahan
This commit is contained in:
parent
209861500f
commit
e1bd868142
3 changed files with 13 additions and 6 deletions
|
@ -18,24 +18,28 @@ final class PhabricatorPagedFormExample extends PhabricatorUIExample {
|
|||
|
||||
|
||||
$page1 = id(new PHUIFormPageView())
|
||||
->setPageName(pht('Page 1'))
|
||||
->addControl(
|
||||
id(new AphrontFormTextControl())
|
||||
->setName('page1')
|
||||
->setLabel('Page 1'));
|
||||
|
||||
$page2 = id(new PHUIFormPageView())
|
||||
->setPageName(pht('Page 2'))
|
||||
->addControl(
|
||||
id(new AphrontFormTextControl())
|
||||
->setName('page2')
|
||||
->setLabel('Page 2'));
|
||||
|
||||
$page3 = id(new PHUIFormPageView())
|
||||
->setPageName(pht('Page 3'))
|
||||
->addControl(
|
||||
id(new AphrontFormTextControl())
|
||||
->setName('page3')
|
||||
->setLabel('Page 3'));
|
||||
|
||||
$page4 = id(new PHUIFormPageView())
|
||||
->setPageName(pht('Page 4'))
|
||||
->addControl(
|
||||
id(new AphrontFormTextControl())
|
||||
->setName('page4')
|
||||
|
|
|
@ -191,7 +191,9 @@ class PHUIFormPageView extends AphrontView {
|
|||
|
||||
public function readFromObject($object) {
|
||||
foreach ($this->getControls() as $name => $control) {
|
||||
$control->readValueFromDictionary($object);
|
||||
if (is_array($object)) {
|
||||
$control->readValueFromDictionary($object);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
|
|
@ -266,16 +266,17 @@ final class PHUIPagedFormView extends AphrontTagView {
|
|||
$errors = id(new AphrontErrorView())->setErrors($errors);
|
||||
}
|
||||
|
||||
$header = null;
|
||||
$box = id(new PHUIObjectBoxView())
|
||||
->setFormError($errors)
|
||||
->setForm($form);
|
||||
|
||||
if ($selected_page->getPageName()) {
|
||||
$header = id(new PHUIHeaderView())
|
||||
->setHeader($selected_page->getPageName());
|
||||
$box->setHeader($header);
|
||||
}
|
||||
|
||||
return id(new PHUIObjectBoxView())
|
||||
->setHeader($header)
|
||||
->setFormError($errors)
|
||||
->setForm($form);
|
||||
return $box;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue