3 final class PhabricatorProjectConfigOptions
4 extends PhabricatorApplicationConfigOptions
{
6 public function getName() {
7 return pht('Projects');
10 public function getDescription() {
11 return pht('Configure Projects.');
14 public function getIcon() {
15 return 'fa-briefcase';
18 public function getGroup() {
22 public function getOptions() {
23 $default_icons = PhabricatorProjectIconSet
::getDefaultConfiguration();
24 $icons_type = 'project.icons';
26 $icons_description = $this->deformat(pht(<<<EOTEXT
27 Allows you to change and customize the available project icons.
29 You can find a list of available icons in {nav UIExamples > Icons and Images}.
31 Configure a list of icon specifications. Each icon specification should be
32 a dictionary, which may contain these keys:
34 - `key` //Required string.// Internal key identifying the icon.
35 - `name` //Required string.// Human-readable icon name.
36 - `icon` //Required string.// Specifies which actual icon image to use.
37 - `image` //Optional string.// Selects a default image. Select an image from
38 `resources/builtins/projects/`.
39 - `default` //Optional bool.// Selects a default icon. Exactly one icon must
40 be selected as the default.
41 - `disabled` //Optional bool.// If true, this icon will no longer be
42 available for selection when creating or editing projects.
43 - `special` //Optional string.// Marks an icon as a special icon:
44 - `milestone` This is the icon for milestones. Exactly one icon must be
45 selected as the milestone icon.
47 You can look at the default configuration below for an example of a valid
52 $default_colors = PhabricatorProjectIconSet
::getDefaultColorMap();
53 $colors_type = 'project.colors';
55 $colors_description = $this->deformat(pht(<<<EOTEXT
56 Allows you to relabel project colors.
58 The list of available colors can not be expanded, but the existing colors may
61 Configure a list of color specifications. Each color specification should be a
62 dictionary, which may contain these keys:
64 - `key` //Required string.// The internal key identifying the color.
65 - `name` //Required string.// Human-readable label for the color.
66 - `default` //Optional bool.// Selects the default color used when creating
67 new projects. Exactly one color must be selected as the default.
69 You can look at the default configuration below for an example of a valid
74 $default_fields = array(
75 'std:project:internal:description' => true,
78 foreach ($default_fields as $key => $enabled) {
79 $default_fields[$key] = array(
80 'disabled' => !$enabled,
84 $custom_field_type = 'custom:PhabricatorCustomFieldConfigOptionType';
87 $subtype_type = 'projects.subtypes';
88 $subtype_default_key = PhabricatorEditEngineSubtype
::SUBTYPE_DEFAULT
;
89 $subtype_example = array(
91 'key' => $subtype_default_key,
92 'name' => pht('Project'),
96 'name' => pht('Team'),
99 $subtype_example = id(new PhutilJSON())->encodeAsList($subtype_example);
101 $subtype_default = array(
103 'key' => $subtype_default_key,
104 'name' => pht('Project'),
108 $subtype_description = $this->deformat(pht(<<<EOTEXT
109 Allows you to define project subtypes. For a more detailed description of
110 subtype configuration, see @{config:maniphest.subtypes}.
115 $this->newOption('projects.custom-field-definitions', 'wild', array())
116 ->setSummary(pht('Custom Projects fields.'))
119 'Array of custom fields for Projects.'))
121 '{"mycompany:motto": {"name": "Project Motto", '.
123 pht('Valid Setting')),
124 $this->newOption('projects.fields', $custom_field_type, $default_fields)
125 ->setCustomData(id(new PhabricatorProject())->getCustomFieldBaseClass())
126 ->setDescription(pht('Select and reorder project fields.')),
127 $this->newOption('projects.icons', $icons_type, $default_icons)
128 ->setSummary(pht('Adjust project icons.'))
129 ->setDescription($icons_description),
130 $this->newOption('projects.colors', $colors_type, $default_colors)
131 ->setSummary(pht('Adjust project colors.'))
132 ->setDescription($colors_description),
133 $this->newOption('projects.subtypes', $subtype_type, $subtype_default)
134 ->setSummary(pht('Define project subtypes.'))
135 ->setDescription($subtype_description)
136 ->addExample($subtype_example, pht('Simple Subtypes')),