Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F104791630
PhabricatorPagedFormExample.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Mar 12, 10:25
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Mar 14, 10:25 (1 d, 18 h)
Engine
blob
Format
Raw Data
Handle
24854564
Attached To
rPH Phabricator
PhabricatorPagedFormExample.php
View Options
<?php
final
class
PhabricatorPagedFormExample
extends
PhabricatorUIExample
{
public
function
getName
()
{
return
pht
(
'Form (Paged)'
);
}
public
function
getDescription
()
{
return
pht
(
'Use %s to render forms with multiple pages.'
,
hsprintf
(
'<tt>PHUIPagedFormView</tt>'
));
}
public
function
renderExample
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$page1
=
id
(
new
PHUIFormPageView
())
->
addControl
(
id
(
new
AphrontFormTextControl
())
->
setName
(
'page1'
)
->
setLabel
(
'Page 1'
));
$page2
=
id
(
new
PHUIFormPageView
())
->
addControl
(
id
(
new
AphrontFormTextControl
())
->
setName
(
'page2'
)
->
setLabel
(
'Page 2'
));
$page3
=
id
(
new
PHUIFormPageView
())
->
addControl
(
id
(
new
AphrontFormTextControl
())
->
setName
(
'page3'
)
->
setLabel
(
'Page 3'
));
$page4
=
id
(
new
PHUIFormPageView
())
->
addControl
(
id
(
new
AphrontFormTextControl
())
->
setName
(
'page4'
)
->
setLabel
(
'Page 4'
));
$form
=
new
PHUIPagedFormView
();
$form
->
setUser
(
$user
);
$form
->
addPage
(
'page1'
,
$page1
);
$form
->
addPage
(
'page2'
,
$page2
);
$form
->
addPage
(
'page3'
,
$page3
);
$form
->
addPage
(
'page4'
,
$page4
);
if
(
$request
->
isFormPost
())
{
$form
->
readFromRequest
(
$request
);
if
(
$form
->
isComplete
())
{
return
id
(
new
AphrontDialogView
())
->
setUser
(
$user
)
->
setTitle
(
pht
(
'Form Complete'
))
->
appendChild
(
pht
(
'You submitted the form. Well done!'
))
->
addCancelButton
(
$request
->
getRequestURI
(),
pht
(
'Again!'
));
}
}
else
{
$form
->
readFromObject
(
null
);
}
return
$form
;
}
}
Event Timeline
Log In to Comment