Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121640076
PhabricatorTypeaheadTokenView.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
Sat, Jul 12, 17:46
Size
2 KB
Mime Type
text/x-php
Expires
Mon, Jul 14, 17:46 (2 d)
Engine
blob
Format
Raw Data
Handle
27364805
Attached To
rPH Phabricator
PhabricatorTypeaheadTokenView.php
View Options
<?php
final
class
PhabricatorTypeaheadTokenView
extends
AphrontTagView
{
private
$key
;
private
$icon
;
private
$inputName
;
private
$value
;
const
KEY_INVALID
=
'<invalid>'
;
public
static
function
newFromTypeaheadResult
(
PhabricatorTypeaheadResult
$result
)
{
return
id
(
new
PhabricatorTypeaheadTokenView
())
->
setKey
(
$result
->
getPHID
())
->
setIcon
(
$result
->
getIcon
())
->
setValue
(
$result
->
getDisplayName
());
}
public
static
function
newFromHandle
(
PhabricatorObjectHandle
$handle
)
{
return
id
(
new
PhabricatorTypeaheadTokenView
())
->
setKey
(
$handle
->
getPHID
())
->
setValue
(
$handle
->
getFullName
())
->
setIcon
(
$handle
->
getIcon
());
}
public
function
setKey
(
$key
)
{
$this
->
key
=
$key
;
return
$this
;
}
public
function
getKey
()
{
return
$this
->
key
;
}
public
function
setInputName
(
$input_name
)
{
$this
->
inputName
=
$input_name
;
return
$this
;
}
public
function
getInputName
()
{
return
$this
->
inputName
;
}
public
function
setIcon
(
$icon
)
{
$this
->
icon
=
$icon
;
return
$this
;
}
public
function
getIcon
()
{
return
$this
->
icon
;
}
public
function
setValue
(
$value
)
{
$this
->
value
=
$value
;
return
$this
;
}
public
function
getValue
()
{
return
$this
->
value
;
}
protected
function
getTagName
()
{
return
'a'
;
}
protected
function
getTagAttributes
()
{
return
array
(
'class'
=>
'jx-tokenizer-token'
,
);
}
protected
function
getTagContent
()
{
$input_name
=
$this
->
getInputName
();
if
(
$input_name
)
{
$input_name
.=
'[]'
;
}
$value
=
$this
->
getValue
();
$icon
=
$this
->
getIcon
();
if
(
$icon
)
{
$value
=
array
(
phutil_tag
(
'span'
,
array
(
'class'
=>
'phui-icon-view phui-font-fa bluetext '
.
$icon
,
)),
$value
,
);
}
return
array
(
$value
,
phutil_tag
(
'input'
,
array
(
'type'
=>
'hidden'
,
'name'
=>
$input_name
,
'value'
=>
$this
->
getKey
(),
)),
phutil_tag
(
'span'
,
array
(
'class'
=>
'jx-tokenizer-x-placeholder'
),
''
),
);
}
}
Event Timeline
Log In to Comment