Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98014241
PhabricatorFlagSelectControl.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
Wed, Jan 8, 16:05
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Jan 10, 16:05 (2 d)
Engine
blob
Format
Raw Data
Handle
23481803
Attached To
rPH Phabricator
PhabricatorFlagSelectControl.php
View Options
<?php
final
class
PhabricatorFlagSelectControl
extends
AphrontFormControl
{
protected
function
getCustomControlClass
()
{
return
'phabricator-flag-select-control'
;
}
protected
function
renderInput
()
{
require_celerity_resource
(
'phabricator-flag-css'
);
$colors
=
PhabricatorFlagColor
::
getColorNameMap
();
$value_map
=
array_fuse
(
$this
->
getValue
());
$file_map
=
array
(
PhabricatorFlagColor
::
COLOR_RED
=>
'red'
,
PhabricatorFlagColor
::
COLOR_ORANGE
=>
'orange'
,
PhabricatorFlagColor
::
COLOR_YELLOW
=>
'yellow'
,
PhabricatorFlagColor
::
COLOR_GREEN
=>
'green'
,
PhabricatorFlagColor
::
COLOR_BLUE
=>
'blue'
,
PhabricatorFlagColor
::
COLOR_PINK
=>
'pink'
,
PhabricatorFlagColor
::
COLOR_PURPLE
=>
'purple'
,
PhabricatorFlagColor
::
COLOR_CHECKERED
=>
'finish'
,
);
$out
=
array
();
foreach
(
$colors
as
$const
=>
$name
)
{
// TODO: This should probably be a sprite sheet.
$partial
=
$file_map
[
$const
];
$uri
=
'/rsrc/image/icon/fatcow/flag_'
.
$partial
.
'.png'
;
$uri
=
celerity_get_resource_uri
(
$uri
);
$icon
=
id
(
new
PHUIIconView
())
->
setImage
(
$uri
);
$input
=
phutil_tag
(
'input'
,
array
(
'type'
=>
'checkbox'
,
'name'
=>
$this
->
getName
().
'[]'
,
'value'
=>
$const
,
'checked'
=>
isset
(
$value_map
[
$const
])
?
'checked'
:
null
,
'class'
=>
'phabricator-flag-select-checkbox'
,
));
$label
=
phutil_tag
(
'label'
,
array
(
'class'
=>
'phabricator-flag-select-label'
,
),
array
(
$icon
,
$input
,
));
$out
[]
=
$label
;
}
return
$out
;
}
}
Event Timeline
Log In to Comment