1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 14:51:06 +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:
epriestley 2013-11-26 08:57:17 -08:00
parent 209861500f
commit e1bd868142
3 changed files with 13 additions and 6 deletions

View file

@ -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')

View file

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

View file

@ -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;
}
}