Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96445608
PonderFooterView.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
Thu, Dec 26, 19:57
Size
2 KB
Mime Type
text/x-php
Expires
Sat, Dec 28, 19:57 (1 d, 9 h)
Engine
blob
Format
Raw Data
Handle
23170848
Attached To
rPH Phabricator
PonderFooterView.php
View Options
<?php
final
class
PonderFooterView
extends
AphrontTagView
{
private
$contentID
;
private
$count
;
private
$actions
=
array
();
public
function
setContentID
(
$content_id
)
{
$this
->
contentID
=
$content_id
;
return
$this
;
}
public
function
setCount
(
$count
)
{
$this
->
count
=
$count
;
return
$this
;
}
public
function
addAction
(
$action
)
{
$this
->
actions
[]
=
$action
;
return
$this
;
}
protected
function
getTagAttributes
()
{
return
array
(
'class'
=>
'ponder-footer-view'
,
);
}
protected
function
getTagContent
()
{
require_celerity_resource
(
'ponder-view-css'
);
Javelin
::
initBehavior
(
'phabricator-reveal-content'
);
$hide_action_id
=
celerity_generate_unique_node_id
();
$show_action_id
=
celerity_generate_unique_node_id
();
$content_id
=
$this
->
contentID
;
if
(
$this
->
count
==
0
)
{
$icon
=
id
(
new
PHUIIconView
())
->
setIconFont
(
'fa-comments msr'
);
$text
=
pht
(
'Add a Comment'
);
}
else
{
$icon
=
id
(
new
PHUIIconView
())
->
setIconFont
(
'fa-comments msr'
);
$text
=
pht
(
'Show %d Comment(s)'
,
new
PhutilNumber
(
$this
->
count
));
}
$actions
=
array
();
$hide_action
=
javelin_tag
(
'a'
,
array
(
'sigil'
=>
'reveal-content'
,
'class'
=>
'ponder-footer-action'
,
'id'
=>
$hide_action_id
,
'href'
=>
'#'
,
'meta'
=>
array
(
'showIDs'
=>
array
(
$content_id
,
$show_action_id
),
'hideIDs'
=>
array
(
$hide_action_id
),
),
),
array
(
$icon
,
$text
));
$show_action
=
javelin_tag
(
'a'
,
array
(
'sigil'
=>
'reveal-content'
,
'style'
=>
'display: none;'
,
'class'
=>
'ponder-footer-action'
,
'id'
=>
$show_action_id
,
'href'
=>
'#'
,
'meta'
=>
array
(
'showIDs'
=>
array
(
$hide_action_id
),
'hideIDs'
=>
array
(
$content_id
,
$show_action_id
),
),
),
array
(
$icon
,
pht
(
'Hide Comments'
)));
$actions
[]
=
$hide_action
;
$actions
[]
=
$show_action
;
return
array
(
$actions
,
$this
->
actions
);
}
}
Event Timeline
Log In to Comment