Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97590763
PhabricatorApplicationProfilePanel.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, Jan 5, 13:03
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Jan 7, 13:03 (2 d)
Engine
blob
Format
Raw Data
Handle
23357248
Attached To
rPH Phabricator
PhabricatorApplicationProfilePanel.php
View Options
<?php
final
class
PhabricatorApplicationProfilePanel
extends
PhabricatorProfilePanel
{
const
PANELKEY
=
'application'
;
public
function
getPanelTypeIcon
()
{
return
'fa-globe'
;
}
public
function
getPanelTypeName
()
{
return
pht
(
'Application'
);
}
public
function
canAddToObject
(
$object
)
{
return
true
;
}
public
function
getDisplayName
(
PhabricatorProfilePanelConfiguration
$config
)
{
$app
=
$this
->
getApplication
(
$config
);
if
(
$app
)
{
return
$app
->
getName
();
}
else
{
return
pht
(
'(Uninstalled Application)'
);
}
return
$app
->
getName
();
}
public
function
buildEditEngineFields
(
PhabricatorProfilePanelConfiguration
$config
)
{
return
array
(
id
(
new
PhabricatorDatasourceEditField
())
->
setKey
(
'application'
)
->
setLabel
(
pht
(
'Application'
))
->
setDatasource
(
new
PhabricatorApplicationDatasource
())
->
setSingleValue
(
$config
->
getPanelProperty
(
'application'
)),
);
}
private
function
getApplication
(
PhabricatorProfilePanelConfiguration
$config
)
{
$viewer
=
$this
->
getViewer
();
$phid
=
$config
->
getPanelProperty
(
'application'
);
$app
=
id
(
new
PhabricatorApplicationQuery
())
->
setViewer
(
$viewer
)
->
withPHIDs
(
array
(
$phid
))
->
executeOne
();
return
$app
;
}
protected
function
newNavigationMenuItems
(
PhabricatorProfilePanelConfiguration
$config
)
{
$viewer
=
$this
->
getViewer
();
$app
=
$this
->
getApplication
(
$config
);
if
(!
$app
)
{
return
array
();
}
$is_installed
=
PhabricatorApplication
::
isClassInstalledForViewer
(
get_class
(
$app
),
$viewer
);
if
(!
$is_installed
)
{
return
array
();
}
$item
=
$this
->
newItem
()
->
setHref
(
$app
->
getApplicationURI
())
->
setName
(
$app
->
getName
())
->
setIcon
(
$app
->
getIcon
());
return
array
(
$item
,
);
}
}
Event Timeline
Log In to Comment