Changeset View
Changeset View
Standalone View
Standalone View
src/docs/user/configuration/custom_fields.diviner
Show All 10 Lines | |||||
For example, you could use custom fields to add an "Estimated Hours" field to | For example, you could use custom fields to add an "Estimated Hours" field to | ||||
tasks, a "Lead" field to projects, or a "T-Shirt Size" field to users. | tasks, a "Lead" field to projects, or a "T-Shirt Size" field to users. | ||||
These applications currently support custom fields: | These applications currently support custom fields: | ||||
| Application | Support | | | Application | Support | | ||||
|-------------|---------| | |-------------|---------| | ||||
| Maniphest | Full Support | | |||||
| Projects | Full Support | | |||||
| People | Full Support | | |||||
| Differential | Partial Support | | | Differential | Partial Support | | ||||
| Diffusion | Limited Support | | | Diffusion | Limited Support | | ||||
| Maniphest | Full Support | | |||||
| Owners | Full Support | | |||||
| People | Full Support | | |||||
| Projects | Full Support | | |||||
Custom fields can appear in many interfaces and support search, editing, and | Custom fields can appear in many interfaces and support search, editing, and | ||||
other features. | other features. | ||||
= Basic Custom Fields = | = Basic Custom Fields = | ||||
To get started with custom fields, you can use configuration to select and | To get started with custom fields, you can use configuration to select and | ||||
reorder fields and to add new simple fields. | reorder fields and to add new simple fields. | ||||
If you don't need complicated display controls or sophisticated validation, | If you don't need complicated display controls or sophisticated validation, | ||||
these simple fields should cover most use cases. They allow you to attach | these simple fields should cover most use cases. They allow you to attach | ||||
things like strings, numbers, and dropdown menus to objects. | things like strings, numbers, and dropdown menus to objects. | ||||
The relevant configuration settings are: | The relevant configuration settings are: | ||||
| Application | Add Fields | Select Fields | | | Application | Add Fields | Select Fields | | ||||
|-------------|------------|---------------| | |-------------|------------|---------------| | ||||
| Maniphest | `maniphest.custom-field-definitions` | `maniphest.fields` | | |||||
| Projects | `projects.custom-field-definitions` | `projects.fields` | | |||||
| People | `user.custom-field-definitions` | `user.fields` | | |||||
| Differential | Planned | `differential.fields` | | | Differential | Planned | `differential.fields` | | ||||
| Diffusion | Planned | Planned | | | Diffusion | Planned | Planned | | ||||
| Maniphest | `maniphest.custom-field-definitions` | `maniphest.fields` | | |||||
| Owners | `owners.custom-field-definitions` | `owners.fields` | | |||||
| People | `user.custom-field-definitions` | `user.fields` | | |||||
| Projects | `projects.custom-field-definitions` | `projects.fields` | | |||||
When adding fields, you'll specify a JSON blob like this (for example, as the | When adding fields, you'll specify a JSON blob like this (for example, as the | ||||
value of `maniphest.custom-field-definitions`): | value of `maniphest.custom-field-definitions`): | ||||
{ | { | ||||
"mycompany:estimated-hours": { | "mycompany:estimated-hours": { | ||||
"name": "Estimated Hours", | "name": "Estimated Hours", | ||||
"type": "int", | "type": "int", | ||||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | |||||
NOTE: This API is somewhat new and fairly large. You should expect that there | NOTE: This API is somewhat new and fairly large. You should expect that there | ||||
will be occasional changes to the API requiring minor updates in your code. | will be occasional changes to the API requiring minor updates in your code. | ||||
To do this, extend the appropriate `CustomField` class for the application you | To do this, extend the appropriate `CustomField` class for the application you | ||||
want to add a field to: | want to add a field to: | ||||
| Application | Extend | | | Application | Extend | | ||||
|-------------|---------| | |-------------|---------| | ||||
| Maniphest | @{class:ManiphestCustomField} | | |||||
| Projects | @{class:PhabricatorProjectCustomField} | | |||||
| People | @{class:PhabricatorUserCustomField} | | |||||
| Differential | @{class:DifferentialCustomField} | | | Differential | @{class:DifferentialCustomField} | | ||||
| Diffusion | @{class:PhabricatorCommitCustomField} | | | Diffusion | @{class:PhabricatorCommitCustomField} | | ||||
| Maniphest | @{class:ManiphestCustomField} | | |||||
| Owners | @{class:PhabricatorOwnersCustomField} | | |||||
| People | @{class:PhabricatorUserCustomField} | | |||||
| Projects | @{class:PhabricatorProjectCustomField} | | |||||
The easiest way to get started is to drop your subclass into | The easiest way to get started is to drop your subclass into | ||||
`phabricator/src/extensions/`, which should make it immediately available in the | `phabricator/src/extensions/`, which should make it immediately available in the | ||||
UI (if you use APC, you may need to restart your webserver). For example, this | UI (if you use APC, you may need to restart your webserver). For example, this | ||||
is a simple template which adds a custom field to Maniphest: | is a simple template which adds a custom field to Maniphest: | ||||
name=ExampleManiphestCustomField.php | name=ExampleManiphestCustomField.php | ||||
<?php | <?php | ||||
Show All 39 Lines |