Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F35364356
PHUIButtonView.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
1 KB
Subscribers
None
PHUIButtonView.php
View Options
<?php
final
class
PHUIButtonView
extends
AphrontTagView
{
const
GREEN
=
'green'
;
const
GREY
=
'grey'
;
const
BLACK
=
'black'
;
const
DISABLED
=
'disabled'
;
const
SMALL
=
'small'
;
const
BIG
=
'big'
;
private
$size
;
private
$text
;
private
$subtext
;
private
$color
;
private
$tag
=
'button'
;
private
$dropdown
;
private
$icon
;
public
function
setText
(
$text
)
{
$this
->
text
=
$text
;
return
$this
;
}
public
function
setSubtext
(
$subtext
)
{
$this
->
subtext
=
$subtext
;
return
$this
;
}
public
function
setColor
(
$color
)
{
$this
->
color
=
$color
;
return
$this
;
}
public
function
setTag
(
$tag
)
{
$this
->
tag
=
$tag
;
return
$this
;
}
public
function
setSize
(
$size
)
{
$this
->
size
=
$size
;
return
$this
;
}
public
function
setDropdown
(
$dd
)
{
$this
->
dropdown
=
$dd
;
return
$this
;
}
public
function
setIcon
(
PHUIIconView
$icon
)
{
$this
->
icon
=
$icon
;
return
$this
;
}
public
function
getTagName
()
{
return
$this
->
tag
;
}
protected
function
getTagAttributes
()
{
require_celerity_resource
(
'phui-button-css'
);
$classes
=
array
();
$classes
[]
=
'button'
;
if
(
$this
->
color
)
{
$classes
[]
=
$this
->
color
;
}
if
(
$this
->
size
)
{
$classes
[]
=
$this
->
size
;
}
if
(
$this
->
dropdown
)
{
$classes
[]
=
'dropdown'
;
}
if
(
$this
->
icon
)
{
$classes
[]
=
'has-icon'
;
}
return
array
(
'class'
=>
$classes
);
}
protected
function
getTagContent
()
{
$icon
=
null
;
$text
=
$this
->
text
;
if
(
$this
->
icon
)
{
$icon
=
$this
->
icon
;
$subtext
=
null
;
if
(
$this
->
subtext
)
{
$subtext
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'phui-button-subtext'
),
$this
->
subtext
);
}
$text
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'phui-button-text'
),
array
(
$text
,
$subtext
));
}
$caret
=
null
;
if
(
$this
->
dropdown
)
{
$caret
=
phutil_tag
(
'span'
,
array
(
'class'
=>
'caret'
),
''
);
}
return
array
(
$icon
,
$text
,
$caret
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Feb 6, 10:00 PM (8 h, 24 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
f1/4b/b01d92b50a0529fb67aa512396f3
Attached To
rPHAB Phabricator
Event Timeline
Log In to Comment