Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2360789
PhabricatorLinkProfilePanel.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
PhabricatorLinkProfilePanel.php
View Options
<?php
final
class
PhabricatorLinkProfilePanel
extends
PhabricatorProfilePanel
{
const
PANELKEY
=
'link'
;
public
function
getPanelTypeIcon
()
{
return
'fa-link'
;
}
public
function
getPanelTypeName
()
{
return
pht
(
'Link'
);
}
public
function
canAddToObject
(
PhabricatorProfilePanelInterface
$object
)
{
return
true
;
}
public
function
getDisplayName
(
PhabricatorProfilePanelConfiguration
$config
)
{
return
$this
->
getLinkName
(
$config
);
}
public
function
buildEditEngineFields
(
PhabricatorProfilePanelConfiguration
$config
)
{
return
array
(
id
(
new
PhabricatorTextEditField
())
->
setKey
(
'name'
)
->
setLabel
(
pht
(
'Name'
))
->
setIsRequired
(
true
)
->
setValue
(
$this
->
getLinkName
(
$config
)),
id
(
new
PhabricatorTextEditField
())
->
setKey
(
'uri'
)
->
setLabel
(
pht
(
'URI'
))
->
setIsRequired
(
true
)
->
setValue
(
$this
->
getLinkURI
(
$config
)),
id
(
new
PhabricatorIconSetEditField
())
->
setKey
(
'icon'
)
->
setLabel
(
pht
(
'Icon'
))
->
setIconSet
(
new
PhabricatorProfilePanelIconSet
())
->
setValue
(
$this
->
getLinkIcon
(
$config
)),
);
}
private
function
getLinkName
(
PhabricatorProfilePanelConfiguration
$config
)
{
return
$config
->
getPanelProperty
(
'name'
);
}
private
function
getLinkIcon
(
PhabricatorProfilePanelConfiguration
$config
)
{
return
$config
->
getPanelProperty
(
'icon'
,
'link'
);
}
private
function
getLinkURI
(
PhabricatorProfilePanelConfiguration
$config
)
{
return
$config
->
getPanelProperty
(
'uri'
);
}
private
function
isValidLinkURI
(
$uri
)
{
return
PhabricatorEnv
::
isValidURIForLink
(
$uri
);
}
protected
function
newNavigationMenuItems
(
PhabricatorProfilePanelConfiguration
$config
)
{
$icon
=
$this
->
getLinkIcon
(
$config
);
$name
=
$this
->
getLinkName
(
$config
);
$href
=
$this
->
getLinkURI
(
$config
);
if
(!
$this
->
isValidLinkURI
(
$href
))
{
$href
=
'#'
;
}
$icon_object
=
id
(
new
PhabricatorProfilePanelIconSet
())
->
getIcon
(
$icon
);
if
(
$icon_object
)
{
$icon_class
=
$icon_object
->
getIcon
();
}
else
{
$icon_class
=
'fa-link'
;
}
$item
=
$this
->
newItem
()
->
setHref
(
$href
)
->
setName
(
$name
)
->
setIcon
(
$icon_class
);
return
array
(
$item
,
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Sep 16, 3:51 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
450842
Default Alt Text
PhabricatorLinkProfilePanel.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment