Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F432387
PhabricatorObjectItemView.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
PhabricatorObjectItemView.php
View Options
<?php
final
class
PhabricatorObjectItemView
extends
AphrontView
{
private
$header
;
private
$href
;
private
$attributes
=
array
();
private
$details
=
array
();
private
$dates
=
array
();
private
$icons
=
array
();
private
$barColor
;
private
$object
;
public
function
setObject
(
$object
)
{
$this
->
object
=
$object
;
return
$this
;
}
public
function
getObject
()
{
return
$this
->
object
;
}
public
function
setHref
(
$href
)
{
$this
->
href
=
$href
;
return
$this
;
}
public
function
getHref
()
{
return
$this
->
href
;
}
public
function
setHeader
(
$header
)
{
$this
->
header
=
$header
;
return
$this
;
}
public
function
getHeader
()
{
return
$this
->
header
;
}
public
function
addIcon
(
$icon
,
$label
=
null
)
{
$this
->
icons
[]
=
array
(
'icon'
=>
$icon
,
'label'
=>
$label
,
);
return
$this
;
}
public
function
setBarColor
(
$bar_color
)
{
$this
->
barColor
=
$bar_color
;
return
$this
;
}
public
function
getBarColor
()
{
return
$this
->
barColor
;
}
public
function
addAttribute
(
$attribute
)
{
$this
->
attributes
[]
=
$attribute
;
return
$this
;
}
public
function
render
()
{
$header
=
phutil_render_tag
(
'a'
,
array
(
'href'
=>
$this
->
href
,
'class'
=>
'phabricator-object-item-name'
,
),
phutil_escape_html
(
$this
->
header
));
$icons
=
null
;
if
(
$this
->
icons
)
{
$icon_list
=
array
();
foreach
(
$this
->
icons
as
$spec
)
{
$icon
=
$spec
[
'icon'
];
$icon
=
phutil_render_tag
(
'span'
,
array
(
'class'
=>
'phabricator-object-item-icon-image '
.
'sprite-icon action-'
.
$icon
,
),
''
);
$label
=
phutil_render_tag
(
'span'
,
array
(
'class'
=>
'phabricator-object-item-icon-label'
,
),
phutil_escape_html
(
$spec
[
'label'
]));
$icon_list
[]
=
phutil_render_tag
(
'li'
,
array
(
'class'
=>
'phabricator-object-item-icon'
,
),
$label
.
$icon
);
}
$icons
=
phutil_render_tag
(
'ul'
,
array
(
'class'
=>
'phabricator-object-item-icons'
,
),
implode
(
''
,
$icon_list
));
}
$attrs
=
null
;
if
(
$this
->
attributes
)
{
$attrs
=
array
();
$spacer
=
phutil_render_tag
(
'span'
,
array
(
'class'
=>
'phabricator-object-item-attribute-spacer'
,
),
'·'
);
$first
=
true
;
foreach
(
$this
->
attributes
as
$attribute
)
{
$attrs
[]
=
phutil_render_tag
(
'li'
,
array
(
'class'
=>
'phabricator-object-item-attribute'
,
),
(
$first
?
null
:
$spacer
).
$attribute
);
$first
=
false
;
}
$attrs
=
phutil_render_tag
(
'ul'
,
array
(
'class'
=>
'phabricator-object-item-attributes'
,
),
implode
(
''
,
$attrs
));
}
$classes
=
array
();
$classes
[]
=
'phabricator-object-item'
;
if
(
$this
->
barColor
)
{
$classes
[]
=
'phabricator-object-item-bar-color-'
.
$this
->
barColor
;
}
return
phutil_render_tag
(
'div'
,
array
(
'class'
=>
implode
(
' '
,
$classes
),
),
$icons
.
$header
.
$attrs
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, May 3, 1:58 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
60607
Default Alt Text
PhabricatorObjectItemView.php (3 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment