Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100907052
PHUICrumbsView.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
Mon, Feb 3, 20:10
Size
2 KB
Mime Type
text/x-php
Expires
Wed, Feb 5, 20:10 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24050887
Attached To
rPH Phabricator
PHUICrumbsView.php
View Options
<?php
final
class
PHUICrumbsView
extends
AphrontView
{
private
$crumbs
=
array
();
private
$actions
=
array
();
protected
function
canAppendChild
()
{
return
false
;
}
/**
* Convenience method for adding a simple crumb with just text, or text and
* a link.
*
* @param string Text of the crumb.
* @param string? Optional href for the crumb.
* @return this
*/
public
function
addTextCrumb
(
$text
,
$href
=
null
)
{
return
$this
->
addCrumb
(
id
(
new
PHUICrumbView
())
->
setName
(
$text
)
->
setHref
(
$href
));
}
public
function
addCrumb
(
PHUICrumbView
$crumb
)
{
$this
->
crumbs
[]
=
$crumb
;
return
$this
;
}
public
function
addAction
(
PHUIListItemView
$action
)
{
$this
->
actions
[]
=
$action
;
return
$this
;
}
public
function
render
()
{
require_celerity_resource
(
'phui-crumbs-view-css'
);
$action_view
=
null
;
if
(
$this
->
actions
)
{
$actions
=
array
();
foreach
(
$this
->
actions
as
$action
)
{
$icon
=
null
;
if
(
$action
->
getIcon
())
{
$icon_name
=
$action
->
getIcon
();
if
(
$action
->
getDisabled
())
{
$icon_name
.=
' lightgreytext'
;
}
$icon
=
id
(
new
PHUIIconView
())
->
setIconFont
(
$icon_name
);
}
$name
=
phutil_tag
(
'span'
,
array
(
'class'
=>
'phui-crumbs-action-name'
,
),
$action
->
getName
());
$action_sigils
=
$action
->
getSigils
();
if
(
$action
->
getWorkflow
())
{
$action_sigils
[]
=
'workflow'
;
}
$action_classes
=
$action
->
getClasses
();
$action_classes
[]
=
'phui-crumbs-action'
;
if
(
$action
->
getDisabled
())
{
$action_classes
[]
=
'phui-crumbs-action-disabled'
;
}
$actions
[]
=
javelin_tag
(
'a'
,
array
(
'href'
=>
$action
->
getHref
(),
'class'
=>
implode
(
' '
,
$action_classes
),
'sigil'
=>
implode
(
' '
,
$action_sigils
),
'style'
=>
$action
->
getStyle
(),
),
array
(
$icon
,
$name
,
));
}
$action_view
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'phui-crumbs-actions'
,
),
$actions
);
}
if
(
$this
->
crumbs
)
{
last
(
$this
->
crumbs
)->
setIsLastCrumb
(
true
);
}
return
phutil_tag
(
'div'
,
array
(
'class'
=>
'phui-crumbs-view '
.
'sprite-gradient gradient-breadcrumbs'
,
),
array
(
$action_view
,
$this
->
crumbs
,
));
}
}
Event Timeline
Log In to Comment