Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93585808
PhabricatorCustomFieldSearchEngineExtension.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
Fri, Nov 29, 23:03
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Dec 1, 23:03 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
22667703
Attached To
rPH Phabricator
PhabricatorCustomFieldSearchEngineExtension.php
View Options
<?php
final
class
PhabricatorCustomFieldSearchEngineExtension
extends
PhabricatorSearchEngineExtension
{
const
EXTENSIONKEY
=
'customfield'
;
public
function
isExtensionEnabled
()
{
return
true
;
}
public
function
getExtensionName
()
{
return
pht
(
'Support for Custom Fields'
);
}
public
function
supportsObject
(
$object
)
{
return
(
$object
instanceof
PhabricatorCustomFieldInterface
);
}
public
function
getFieldSpecificationsForConduit
(
$object
)
{
$fields
=
PhabricatorCustomField
::
getObjectFields
(
$object
,
PhabricatorCustomField
::
ROLE_CONDUIT
);
$map
=
array
();
foreach
(
$fields
->
getFields
()
as
$field
)
{
$key
=
$field
->
getModernFieldKey
();
$map
[
$key
]
=
array
(
'type'
=>
'wild'
,
'description'
=>
$field
->
getFieldDescription
(),
);
}
return
$map
;
}
public
function
getFieldValuesForConduit
(
$object
)
{
// TODO: This is currently very inefficient. We should bulk-load these
// field values instead.
$fields
=
PhabricatorCustomField
::
getObjectFields
(
$object
,
PhabricatorCustomField
::
ROLE_CONDUIT
);
$fields
->
setViewer
(
$this
->
getViewer
())
->
readFieldsFromStorage
(
$object
);
$map
=
array
();
foreach
(
$fields
->
getFields
()
as
$field
)
{
$key
=
$field
->
getModernFieldKey
();
$map
[
$key
]
=
$field
->
getConduitDictionaryValue
();
}
return
$map
;
}
}
Event Timeline
Log In to Comment