Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100807950
PhabricatorErrorExample.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
Sun, Feb 2, 22:46
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Feb 4, 22:46 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24025642
Attached To
rPH Phabricator
PhabricatorErrorExample.php
View Options
<?php
final
class
PhabricatorErrorExample
extends
PhabricatorUIExample
{
public
function
getName
()
{
return
'Errors'
;
}
public
function
getDescription
()
{
return
hsprintf
(
'Use <tt>AphrontErrorView</tt> to render errors, warnings and notices.'
);
}
public
function
renderExample
()
{
$request
=
$this
->
getRequest
();
$user
=
$request
->
getUser
();
$sevs
=
array
(
AphrontErrorView
::
SEVERITY_ERROR
=>
'Error'
,
AphrontErrorView
::
SEVERITY_WARNING
=>
'Warning'
,
AphrontErrorView
::
SEVERITY_NOTICE
=>
'Notice'
,
AphrontErrorView
::
SEVERITY_NODATA
=>
'No Data'
,
);
$views
=
array
();
foreach
(
$sevs
as
$sev
=>
$title
)
{
$view
=
new
AphrontErrorView
();
$view
->
setSeverity
(
$sev
);
$view
->
setTitle
(
$title
);
$view
->
appendChild
(
'Several issues were encountered.'
);
$view
->
setErrors
(
array
(
'Overcooked.'
,
'Too much salt.'
,
'Full of sand.'
,
));
$views
[]
=
$view
;
}
return
$views
;
}
}
Event Timeline
Log In to Comment