Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F94006546
PhabricatorUIExampleRenderController.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
Tue, Dec 3, 05:01
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Dec 5, 05:01 (2 d)
Engine
blob
Format
Raw Data
Handle
22703650
Attached To
rPH Phabricator
PhabricatorUIExampleRenderController.php
View Options
<?php
final
class
PhabricatorUIExampleRenderController
extends
PhabricatorController
{
public
function
shouldAllowPublic
()
{
return
true
;
}
public
function
handleRequest
(
AphrontRequest
$request
)
{
$id
=
$request
->
getURIData
(
'class'
);
$classes
=
id
(
new
PhutilClassMapQuery
())
->
setAncestorClass
(
'PhabricatorUIExample'
)
->
setSortMethod
(
'getName'
)
->
execute
();
$nav
=
new
AphrontSideNavFilterView
();
$nav
->
setBaseURI
(
new
PhutilURI
(
$this
->
getApplicationURI
(
'view/'
)));
$groups
=
mgroup
(
$classes
,
'getCategory'
);
ksort
(
$groups
);
foreach
(
$groups
as
$group
=>
$group_classes
)
{
$nav
->
addLabel
(
$group
);
foreach
(
$group_classes
as
$class
=>
$obj
)
{
$name
=
$obj
->
getName
();
$nav
->
addFilter
(
$class
,
$name
);
}
}
$selected
=
$nav
->
selectFilter
(
$id
,
head_key
(
$classes
));
$example
=
$classes
[
$selected
];
$example
->
setRequest
(
$this
->
getRequest
());
$result
=
$example
->
renderExample
();
if
(
$result
instanceof
AphrontResponse
)
{
// This allows examples to generate dialogs, etc., for demonstration.
return
$result
;
}
require_celerity_resource
(
'phabricator-ui-example-css'
);
$crumbs
=
$this
->
buildApplicationCrumbs
();
$crumbs
->
addTextCrumb
(
$example
->
getName
());
$note
=
id
(
new
PHUIInfoView
())
->
setTitle
(
pht
(
'%s (%s)'
,
$example
->
getName
(),
get_class
(
$example
)))
->
appendChild
(
$example
->
getDescription
())
->
setSeverity
(
PHUIInfoView
::
SEVERITY_NODATA
);
$nav
->
appendChild
(
array
(
$crumbs
,
$note
,
$result
,
));
return
$this
->
newPage
()
->
setTitle
(
$example
->
getName
())
->
appendChild
(
$nav
);
}
}
Event Timeline
Log In to Comment