Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93605557
PhabricatorFormExample.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
Sat, Nov 30, 02:49
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Dec 2, 02:49 (1 d, 22 h)
Engine
blob
Format
Raw Data
Handle
22672755
Attached To
rPH Phabricator
PhabricatorFormExample.php
View Options
<?php
final
class
PhabricatorFormExample
extends
PhabricatorUIExample
{
public
function
getName
()
{
return
'Form'
;
}
public
function
getDescription
()
{
return
hsprintf
(
'Use <tt>AphrontFormView</tt> to render forms.'
);
}
public
function
renderExample
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$start_time
=
id
(
new
AphrontFormDateControl
())
->
setUser
(
$user
)
->
setName
(
'start'
)
->
setLabel
(
'Start'
)
->
setInitialTime
(
AphrontFormDateControl
::
TIME_START_OF_BUSINESS
);
$end_time
=
id
(
new
AphrontFormDateControl
())
->
setUser
(
$user
)
->
setName
(
'end'
)
->
setLabel
(
'End'
)
->
setInitialTime
(
AphrontFormDateControl
::
TIME_END_OF_BUSINESS
);
$null_time
=
id
(
new
AphrontFormDateControl
())
->
setUser
(
$user
)
->
setName
(
'nulltime'
)
->
setLabel
(
'Nullable'
)
->
setAllowNull
(
true
);
if
(
$request
->
isFormPost
())
{
$start_value
=
$start_time
->
readValueFromRequest
(
$request
);
$end_value
=
$end_time
->
readValueFromRequest
(
$request
);
$null_value
=
$null_time
->
readValueFromRequest
(
$request
);
}
$form
=
id
(
new
AphrontFormView
())
->
setUser
(
$user
)
->
appendChild
(
$start_time
)
->
appendChild
(
$end_time
)
->
appendChild
(
$null_time
)
->
appendChild
(
id
(
new
AphrontFormSubmitControl
())
->
setValue
(
'Submit'
));
return
$form
;
}
}
Event Timeline
Log In to Comment