Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2895044
PhabricatorCustomFieldHeraldField.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
PhabricatorCustomFieldHeraldField.php
View Options
<?php
final
class
PhabricatorCustomFieldHeraldField
extends
HeraldField
{
const
FIELDCONST
=
'herald.custom'
;
private
$customField
;
public
function
setCustomField
(
PhabricatorCustomField
$custom_field
)
{
$this
->
customField
=
$custom_field
;
return
$this
;
}
public
function
getCustomField
(
)
{
return
$this
->
customField
;
}
public
function
getFieldGroupKey
(
)
{
return
PhabricatorCustomFieldHeraldFieldGroup
::
FIELDGROUPKEY
;
}
public
function
supportsObject
(
$object
)
{
return
(
$object
instanceof
PhabricatorCustomFieldInterface
)
;
}
public
function
getFieldsForObject
(
$object
)
{
$field_list
=
PhabricatorCustomField
::
getObjectFields
(
$object
,
PhabricatorCustomField
::
ROLE_HERALD
)
;
$field_list
->
setViewer
(
PhabricatorUser
::
getOmnipotentUser
(
)
)
;
$field_list
->
readFieldsFromStorage
(
$object
)
;
$prefix
=
'herald.custom/'
;
$limit
=
self
::
getFieldConstantByteLimit
(
)
;
$map
=
array
(
)
;
foreach
(
$field_list
->
getFields
(
)
as
$field
)
{
$key
=
$field
->
getFieldKey
(
)
;
// NOTE: This use of digestToLength() isn't preferred (you should
// normally digest a key unconditionally, so that it isn't possible to
// arrange a collision) but preserves backward compatibility.
$full_key
=
$prefix
.
$key
;
if
(
strlen
(
$full_key
)
>
$limit
)
{
$full_key
=
PhabricatorHash
::
digestToLength
(
$full_key
,
$limit
)
;
}
$map
[
$full_key
]
=
id
(
new
PhabricatorCustomFieldHeraldField
(
)
)
->
setCustomField
(
$field
)
;
}
return
$map
;
}
public
function
getHeraldFieldName
(
)
{
return
$this
->
getCustomField
(
)
->
getHeraldFieldName
(
)
;
}
public
function
getHeraldFieldValue
(
$object
)
{
return
$this
->
getCustomField
(
)
->
getHeraldFieldValue
(
)
;
}
public
function
getHeraldFieldConditions
(
)
{
return
$this
->
getCustomField
(
)
->
getHeraldFieldConditions
(
)
;
}
protected
function
getHeraldFieldStandardType
(
)
{
return
$this
->
getCustomField
(
)
->
getHeraldFieldStandardType
(
)
;
}
public
function
getHeraldFieldValueType
(
$condition
)
{
if
(
$this
->
getHeraldFieldStandardType
(
)
)
{
return
parent
::
getHeraldFieldValueType
(
$condition
)
;
}
return
$this
->
getCustomField
(
)
->
getHeraldFieldValueType
(
$condition
)
;
}
protected
function
getDatasource
(
)
{
return
$this
->
getCustomField
(
)
->
getHeraldDatasource
(
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Jan 19 2025, 20:52 (6 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128625
Default Alt Text
PhabricatorCustomFieldHeraldField.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment