[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/infrastructure/customfield/field/ -> PhabricatorCustomField.php (summary)

(no description)

File Size: 1383 lines (37 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 81 functions

  getObjectFields()
  getObjectField()
  buildFieldList()
  getFieldKey()
  getFieldName()
  getFieldDescription()
  createFields()
  isFieldEnabled()
  shouldEnableForRole()
  canDisableField()
  shouldDisableByDefault()
  getFieldIndex()
  canSetProxy()
  setProxy()
  getProxy()
  setObject()
  readValueFromObject()
  getObject()
  didSetObject()
  setViewer()
  getViewer()
  requireViewer()
  renderHandleList()
  shouldUseStorage()
  newStorageObject()
  getValueForStorage()
  setValueFromStorage()
  shouldAppearInApplicationSearch()
  buildFieldIndexes()
  buildOrderIndex()
  newStringIndexStorage()
  newNumericIndexStorage()
  newStringIndex()
  newNumericIndex()
  readApplicationSearchValueFromRequest()
  applyApplicationSearchConstraintToQuery()
  appendToApplicationSearchForm()
  getRequiredHandlePHIDsForApplicationSearch()
  shouldAppearInApplicationTransactions()
  getApplicationTransactionType()
  getApplicationTransactionMetadata()
  getOldValueForApplicationTransactions()
  getNewValueForApplicationTransactions()
  setValueFromApplicationTransactions()
  getNewValueFromApplicationTransactions()
  getApplicationTransactionHasEffect()
  applyApplicationTransactionInternalEffects()
  getApplicationTransactionRemarkupBlocks()
  applyApplicationTransactionExternalEffects()
  validateApplicationTransactions()
  getApplicationTransactionTitle()
  getApplicationTransactionTitleForFeed()
  getApplicationTransactionHasChangeDetails()
  getApplicationTransactionChangeDetails()
  getApplicationTransactionRequiredHandlePHIDs()
  shouldHideInApplicationTransactions()
  buildApplicationTransactionMailBody()
  shouldAppearInTransactionMail()
  updateTransactionMailBody()
  shouldAppearInEditView()
  readValueFromRequest()
  getRequiredHandlePHIDsForEdit()
  getInstructionsForEdit()
  renderEditControl()
  shouldAppearInPropertyView()
  renderPropertyViewLabel()
  renderPropertyViewValue()
  getStyleForPropertyView()
  getIconForPropertyView()
  getRequiredHandlePHIDsForPropertyView()
  shouldAppearInListView()
  renderOnListItem()
  shouldAppearInGlobalSearch()
  updateAbstractDocument()
  shouldAppearInConduitDictionary()
  getConduitDictionaryValue()
  shouldAppearInHerald()
  getHeraldFieldName()
  getHeraldFieldValue()
  getHeraldFieldConditions()
  getHeraldFieldValueType()

Functions
Functions that are not part of a class:

getObjectFields(PhabricatorCustomFieldInterface $object,$role)   X-Ref


getObjectField(PhabricatorCustomFieldInterface $object,$role,$field_key)   X-Ref


buildFieldList($base_class, array $spec, $object)   X-Ref


getFieldKey()   X-Ref
Return a key which uniquely identifies this field, like
"mycompany:dinosaur:count". Normally you should provide some level of
namespacing to prevent collisions.

return: string String which uniquely identifies this field.

getFieldName()   X-Ref
Return a human-readable field name.

return: string Human readable field name.

getFieldDescription()   X-Ref
Return a short, human-readable description of the field's behavior. This
provides more context to administrators when they are customizing fields.

return: string|null Optional human-readable description.

createFields($object)   X-Ref
Most field implementations are unique, in that one class corresponds to
one field. However, some field implementations are general and a single
implementation may drive several fields.

For general implementations, the general field implementation can return
multiple field instances here.

param: object The object to create fields for.
return: list<PhabricatorCustomField> List of fields.

isFieldEnabled()   X-Ref
You can return `false` here if the field should not be enabled for any
role. For example, it might depend on something (like an application or
library) which isn't installed, or might have some global configuration
which allows it to be disabled.

return: bool False to completely disable this field for all roles.

shouldEnableForRole($role)   X-Ref
Low level selector for field availability. Fields can appear in different
roles (like an edit view, a list view, etc.), but not every field needs
to appear everywhere. Fields that are disabled in a role won't appear in
that context within applications.

Normally, you do not need to override this method. Instead, override the
methods specific to roles you want to enable. For example, implement
@{method:shouldUseStorage()} to activate the `'storage'` role.

return: bool True to enable the field for the given role.

canDisableField()   X-Ref
Allow administrators to disable this field. Most fields should allow this,
but some are fundamental to the behavior of the application and can be
locked down to avoid chaos, disorder, and the decline of civilization.

return: bool False to prevent this field from being disabled through

shouldDisableByDefault()   X-Ref
No description

getFieldIndex()   X-Ref
Return an index string which uniquely identifies this field.

return: string Index string which uniquely identifies this field.

canSetProxy()   X-Ref
Proxies allow a field to use some other field's implementation for most
of their behavior while still subclassing an application field. When a
proxy is set for a field with @{method:setProxy}, all of its methods will
call through to the proxy by default.

This is most commonly used to implement configuration-driven custom fields
using @{class:PhabricatorStandardCustomField}.

This method must be overridden to return `true` before a field can accept
proxies.

return: bool True if you can @{method:setProxy} this field.

setProxy(PhabricatorCustomField $proxy)   X-Ref
Set the proxy implementation for this field. See @{method:canSetProxy} for
discussion of field proxies.

param: PhabricatorCustomField Field implementation.
return: this

getProxy()   X-Ref
Get the field's proxy implementation, if any. For discussion, see
@{method:canSetProxy}.

return: PhabricatorCustomField|null  Proxy field, if one is set.

setObject(PhabricatorCustomFieldInterface $object)   X-Ref
Sets the object this field belongs to.

param: PhabricatorCustomFieldInterface The object this field belongs to.
return: this

readValueFromObject(PhabricatorCustomFieldInterface $object)   X-Ref
Read object data into local field storage, if applicable.

param: PhabricatorCustomFieldInterface The object this field belongs to.
return: this

getObject()   X-Ref
Get the object this field belongs to.

return: PhabricatorCustomFieldInterface The object this field belongs to.

didSetObject(PhabricatorCustomFieldInterface $object)   X-Ref
This is a hook, primarily for subclasses to load object data.

return: PhabricatorCustomFieldInterface The object this field belongs to.
return: void

setViewer(PhabricatorUser $viewer)   X-Ref


getViewer()   X-Ref


requireViewer()   X-Ref


renderHandleList(array $handles)   X-Ref


shouldUseStorage()   X-Ref
Return true to use field storage.

Fields which can be edited by the user will most commonly use storage,
while some other types of fields (for instance, those which just display
information in some stylized way) may not. Many builtin fields do not use
storage because their data is available on the object itself.

If you implement this, you must also implement @{method:getValueForStorage}
and @{method:setValueFromStorage}.

return: bool True to use storage.

newStorageObject()   X-Ref
Return a new, empty storage object. This should be a subclass of
@{class:PhabricatorCustomFieldStorage} which is bound to the application's
database.

return: PhabricatorCustomFieldStorage New empty storage object.

getValueForStorage()   X-Ref
Return a serialized representation of the field value, appropriate for
storing in auxiliary field storage. You must implement this method if
you implement @{method:shouldUseStorage}.

If the field value is a scalar, it can be returned unmodiifed. If not,
it should be serialized (for example, using JSON).

return: string Serialized field value.

setValueFromStorage($value)   X-Ref
Set the field's value given a serialized storage value. This is called
when the field is loaded; if no data is available, the value will be
null. You must implement this method if you implement
@{method:shouldUseStorage}.

Usually, the value can be loaded directly. If it isn't a scalar, you'll
need to undo whatever serialization you applied in
@{method:getValueForStorage}.

param: string|null Serialized field representation (from
return: this

shouldAppearInApplicationSearch()   X-Ref
Appearing in ApplicationSearch allows a field to be indexed and searched
for.

return: bool True to appear in ApplicationSearch.

buildFieldIndexes()   X-Ref
Return one or more indexes which this field can meaningfully query against
to implement ApplicationSearch.

Normally, you should build these using @{method:newStringIndex} and
@{method:newNumericIndex}. For example, if a field holds a numeric value
it might return a single numeric index:

return array($this->newNumericIndex($this->getValue()));

If a field holds a more complex value (like a list of users), it might
return several string indexes:

$indexes = array();
foreach ($this->getValue() as $phid) {
$indexes[] = $this->newStringIndex($phid);
}
return $indexes;

return: list<PhabricatorCustomFieldIndexStorage> List of indexes.

buildOrderIndex()   X-Ref
Return an index against which this field can be meaningfully ordered
against to implement ApplicationSearch.

This should be a single index, normally built using
@{method:newStringIndex} and @{method:newNumericIndex}.

The value of the index is not used.

Return null from this method if the field can not be ordered.

return: PhabricatorCustomFieldIndexStorage A single index to order by.

newStringIndexStorage()   X-Ref
Build a new empty storage object for storing string indexes. Normally,
this should be a concrete subclass of
@{class:PhabricatorCustomFieldStringIndexStorage}.

return: PhabricatorCustomFieldStringIndexStorage Storage object.

newNumericIndexStorage()   X-Ref
Build a new empty storage object for storing string indexes. Normally,
this should be a concrete subclass of
@{class:PhabricatorCustomFieldStringIndexStorage}.

return: PhabricatorCustomFieldStringIndexStorage Storage object.

newStringIndex($value)   X-Ref
Build and populate storage for a string index.

param: string String to index.
return: PhabricatorCustomFieldStringIndexStorage Populated storage.

newNumericIndex($value)   X-Ref
Build and populate storage for a numeric index.

param: string Numeric value to index.
return: PhabricatorCustomFieldNumericIndexStorage Populated storage.

readApplicationSearchValueFromRequest(PhabricatorApplicationSearchEngine $engine,AphrontRequest $request)   X-Ref
Read a query value from a request, for storage in a saved query. Normally,
this method should, e.g., read a string out of the request.

param: PhabricatorApplicationSearchEngine Engine building the query.
param: AphrontRequest Request to read from.
return: wild

applyApplicationSearchConstraintToQuery(PhabricatorApplicationSearchEngine $engine,PhabricatorCursorPagedPolicyAwareQuery $query,$value)   X-Ref
Constrain a query, given a field value. Generally, this method should
use `with...()` methods to apply filters or other constraints to the
query.

param: PhabricatorApplicationSearchEngine Engine executing the query.
param: PhabricatorCursorPagedPolicyAwareQuery Query to constrain.
param: wild Constraint provided by the user.
return: void

appendToApplicationSearchForm(PhabricatorApplicationSearchEngine $engine,AphrontFormView $form,$value,array $handles)   X-Ref
Append search controls to the interface. If you need handles, use
@{method:getRequiredHandlePHIDsForApplicationSearch} to get them.

param: PhabricatorApplicationSearchEngine Engine constructing the form.
param: AphrontFormView The form to update.
param: wild Value from the saved query.
param: list<PhabricatorObjectHandle> List of handles.
return: void

getRequiredHandlePHIDsForApplicationSearch($value)   X-Ref
Return a list of PHIDs which @{method:appendToApplicationSearchForm} needs
handles for. This is primarily useful if the field stores PHIDs and you
need to (for example) render a tokenizer control.

param: wild Value from the saved query.
return: list<phid> List of PHIDs.

shouldAppearInApplicationTransactions()   X-Ref
Appearing in ApplicationTrasactions allows a field to be edited using
standard workflows.

return: bool True to appear in ApplicationTransactions.

getApplicationTransactionType()   X-Ref


getApplicationTransactionMetadata()   X-Ref


getOldValueForApplicationTransactions()   X-Ref


getNewValueForApplicationTransactions()   X-Ref


setValueFromApplicationTransactions($value)   X-Ref


getNewValueFromApplicationTransactions(PhabricatorApplicationTransaction $xaction)   X-Ref


getApplicationTransactionHasEffect(PhabricatorApplicationTransaction $xaction)   X-Ref


applyApplicationTransactionInternalEffects(PhabricatorApplicationTransaction $xaction)   X-Ref


getApplicationTransactionRemarkupBlocks(PhabricatorApplicationTransaction $xaction)   X-Ref


applyApplicationTransactionExternalEffects(PhabricatorApplicationTransaction $xaction)   X-Ref


validateApplicationTransactions(PhabricatorApplicationTransactionEditor $editor,$type,array $xactions)   X-Ref
Validate transactions for an object. This allows you to raise an error
when a transaction would set a field to an invalid value, or when a field
is required but no transactions provide value.

param: PhabricatorLiskDAO Editor applying the transactions.
param: string Transaction type. This type is always
param: list<PhabricatorApplicationTransaction> Transactions being applied,
return: list<PhabricatorApplicationTransactionValidationError> Validation

getApplicationTransactionTitle(PhabricatorApplicationTransaction $xaction)   X-Ref
No description

getApplicationTransactionTitleForFeed(PhabricatorApplicationTransaction $xaction,PhabricatorFeedStory $story)   X-Ref
No description

getApplicationTransactionHasChangeDetails(PhabricatorApplicationTransaction $xaction)   X-Ref
No description

getApplicationTransactionChangeDetails(PhabricatorApplicationTransaction $xaction,PhabricatorUser $viewer)   X-Ref
No description

getApplicationTransactionRequiredHandlePHIDs(PhabricatorApplicationTransaction $xaction)   X-Ref
No description

shouldHideInApplicationTransactions(PhabricatorApplicationTransaction $xaction)   X-Ref
No description

buildApplicationTransactionMailBody(PhabricatorApplicationTransaction $xaction,PhabricatorMetaMTAMailBody $body)   X-Ref
TODO: this is only used by Diffusion right now and everything is completely
faked since Diffusion doesn't use ApplicationTransactions yet. This should
get fleshed out as we have more use cases.


shouldAppearInTransactionMail()   X-Ref


updateTransactionMailBody(PhabricatorMetaMTAMailBody $body,PhabricatorApplicationTransactionEditor $editor,array $xactions)   X-Ref


shouldAppearInEditView()   X-Ref


readValueFromRequest(AphrontRequest $request)   X-Ref


getRequiredHandlePHIDsForEdit()   X-Ref


getInstructionsForEdit()   X-Ref


renderEditControl(array $handles)   X-Ref


shouldAppearInPropertyView()   X-Ref


renderPropertyViewLabel()   X-Ref


renderPropertyViewValue(array $handles)   X-Ref


getStyleForPropertyView()   X-Ref


getIconForPropertyView()   X-Ref


getRequiredHandlePHIDsForPropertyView()   X-Ref


shouldAppearInListView()   X-Ref


renderOnListItem(PHUIObjectItemView $view)   X-Ref


shouldAppearInGlobalSearch()   X-Ref


updateAbstractDocument(PhabricatorSearchAbstractDocument $document)   X-Ref


shouldAppearInConduitDictionary()   X-Ref


getConduitDictionaryValue()   X-Ref


shouldAppearInHerald()   X-Ref
Return `true` to make this field available in Herald.

return: bool True to expose the field in Herald.

getHeraldFieldName()   X-Ref
Get the name of the field in Herald. By default, this uses the
normal field name.

return: string Herald field name.

getHeraldFieldValue()   X-Ref
Get the field value for evaluation by Herald.

return: wild Field value.

getHeraldFieldConditions()   X-Ref
Get the available conditions for this field in Herald.

return: list<const> List of Herald condition constants.

getHeraldFieldValueType($condition)   X-Ref
Get the Herald value type for the given condition.

param: const       Herald condition constant.
return: const|null  Herald value type, or null to use the default.



Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1