Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F445507
PhabricatorApplicationProfilePanel.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
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
(
PhabricatorProfileMenuItemConfiguration
$config
)
{
$app
=
$this
->
getApplication
(
$config
);
if
(
$app
)
{
return
$app
->
getName
();
}
else
{
return
pht
(
'(Uninstalled Application)'
);
}
return
$app
->
getName
();
}
public
function
buildEditEngineFields
(
PhabricatorProfileMenuItemConfiguration
$config
)
{
return
array
(
id
(
new
PhabricatorDatasourceEditField
())
->
setKey
(
'application'
)
->
setLabel
(
pht
(
'Application'
))
->
setDatasource
(
new
PhabricatorApplicationDatasource
())
->
setSingleValue
(
$config
->
getMenuItemProperty
(
'application'
)),
);
}
private
function
getApplication
(
PhabricatorProfileMenuItemConfiguration
$config
)
{
$viewer
=
$this
->
getViewer
();
$phid
=
$config
->
getMenuItemProperty
(
'application'
);
$app
=
id
(
new
PhabricatorApplicationQuery
())
->
setViewer
(
$viewer
)
->
withPHIDs
(
array
(
$phid
))
->
executeOne
();
return
$app
;
}
protected
function
newNavigationMenuItems
(
PhabricatorProfileMenuItemConfiguration
$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
,
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, May 4, 1:31 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
65699
Default Alt Text
PhabricatorApplicationProfilePanel.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment