@@ -18,87 +18,104 @@ public static function getDefaultConfiguration() {
18
18
'icon ' => 'fa-briefcase ' ,
19
19
'name ' => pht ('Project ' ),
20
20
'default ' => true ,
21
+ 'image ' => 'v3/briefcase.png ' ,
21
22
),
22
23
array (
23
24
'key ' => 'tag ' ,
24
25
'icon ' => 'fa-tags ' ,
25
26
'name ' => pht ('Tag ' ),
27
+ 'image ' => 'v3/tag.png ' ,
26
28
),
27
29
array (
28
30
'key ' => 'policy ' ,
29
31
'icon ' => 'fa-lock ' ,
30
32
'name ' => pht ('Policy ' ),
33
+ 'image ' => 'v3/lock.png ' ,
31
34
),
32
35
array (
33
36
'key ' => 'group ' ,
34
37
'icon ' => 'fa-users ' ,
35
38
'name ' => pht ('Group ' ),
39
+ 'image ' => 'v3/people.png ' ,
36
40
),
37
41
array (
38
42
'key ' => 'folder ' ,
39
43
'icon ' => 'fa-folder ' ,
40
44
'name ' => pht ('Folder ' ),
45
+ 'image ' => 'v3/folder.png ' ,
41
46
),
42
47
array (
43
48
'key ' => 'timeline ' ,
44
49
'icon ' => 'fa-calendar ' ,
45
50
'name ' => pht ('Timeline ' ),
51
+ 'image ' => 'v3/calendar.png ' ,
46
52
),
47
53
array (
48
54
'key ' => 'goal ' ,
49
55
'icon ' => 'fa-flag-checkered ' ,
50
56
'name ' => pht ('Goal ' ),
57
+ 'image ' => 'v3/flag.png ' ,
51
58
),
52
59
array (
53
60
'key ' => 'release ' ,
54
61
'icon ' => 'fa-truck ' ,
55
62
'name ' => pht ('Release ' ),
63
+ 'image ' => 'v3/truck.png ' ,
56
64
),
57
65
array (
58
66
'key ' => 'bugs ' ,
59
67
'icon ' => 'fa-bug ' ,
60
68
'name ' => pht ('Bugs ' ),
69
+ 'image ' => 'v3/bug.png ' ,
61
70
),
62
71
array (
63
72
'key ' => 'cleanup ' ,
64
73
'icon ' => 'fa-trash-o ' ,
65
74
'name ' => pht ('Cleanup ' ),
75
+ 'image ' => 'v3/trash.png ' ,
66
76
),
67
77
array (
68
78
'key ' => 'umbrella ' ,
69
79
'icon ' => 'fa-umbrella ' ,
70
80
'name ' => pht ('Umbrella ' ),
81
+ 'image ' => 'v3/umbrella.png ' ,
71
82
),
72
83
array (
73
84
'key ' => 'communication ' ,
74
85
'icon ' => 'fa-envelope ' ,
75
86
'name ' => pht ('Communication ' ),
87
+ 'image ' => 'v3/mail.png ' ,
76
88
),
77
89
array (
78
90
'key ' => 'organization ' ,
79
91
'icon ' => 'fa-building ' ,
80
92
'name ' => pht ('Organization ' ),
93
+ 'image ' => 'v3/organization.png ' ,
81
94
),
82
95
array (
83
96
'key ' => 'infrastructure ' ,
84
97
'icon ' => 'fa-cloud ' ,
85
98
'name ' => pht ('Infrastructure ' ),
99
+ 'image ' => 'v3/cloud.png ' ,
86
100
),
87
101
array (
88
102
'key ' => 'account ' ,
89
103
'icon ' => 'fa-credit-card ' ,
90
104
'name ' => pht ('Account ' ),
105
+ 'image ' => 'v3/creditcard.png ' ,
91
106
),
92
107
array (
93
108
'key ' => 'experimental ' ,
94
109
'icon ' => 'fa-flask ' ,
95
110
'name ' => pht ('Experimental ' ),
111
+ 'image ' => 'v3/experimental.png ' ,
96
112
),
97
113
array (
98
114
'key ' => 'milestone ' ,
99
115
'icon ' => 'fa-map-marker ' ,
100
116
'name ' => pht ('Milestone ' ),
101
117
'special ' => self ::SPECIAL_MILESTONE ,
118
+ 'image ' => 'v3/marker.png ' ,
102
119
),
103
120
);
104
121
}
@@ -149,6 +166,11 @@ public static function getIconName($key) {
149
166
return idx ($ spec , 'name ' , null );
150
167
}
151
168
169
+ public static function getIconImage ($ key ) {
170
+ $ spec = self ::getIconSpec ($ key );
171
+ return idx ($ spec , 'image ' , 'v3/briefcase.png ' );
172
+ }
173
+
152
174
private static function getIconSpec ($ key ) {
153
175
$ icons = self ::getIconSpecifications ();
154
176
foreach ($ icons as $ icon ) {
@@ -190,6 +212,7 @@ public static function validateConfiguration($config) {
190
212
'key ' => 'string ' ,
191
213
'name ' => 'string ' ,
192
214
'icon ' => 'string ' ,
215
+ 'image ' => 'optional string ' ,
193
216
'special ' => 'optional string ' ,
194
217
'disabled ' => 'optional bool ' ,
195
218
'default ' => 'optional bool ' ,
@@ -239,6 +262,25 @@ public static function validateConfiguration($config) {
239
262
240
263
$ is_disabled = idx ($ value , 'disabled ' );
241
264
265
+ if (idx ($ value , 'image ' )) {
266
+ $ builtin = idx ($ value , 'image ' );
267
+ $ builtin_map = id (new PhabricatorFilesOnDiskBuiltinFile ())
268
+ ->getProjectBuiltinFiles ();
269
+ $ builtin_map = array_flip ($ builtin_map );
270
+
271
+ $ root = dirname (phutil_get_library_root ('phabricator ' ));
272
+ $ image = $ root .'/resources/builtin/projects/ ' .$ builtin ;
273
+
274
+ if (!array_key_exists ($ image , $ builtin_map )) {
275
+ throw new Exception (
276
+ pht (
277
+ 'The project image ("%s") specified for ("%s") ' .
278
+ 'was not found in the folder "resources/builtin/projects/". ' ,
279
+ $ builtin ,
280
+ $ key ));
281
+ }
282
+ }
283
+
242
284
if (idx ($ value , 'default ' )) {
243
285
if ($ default === null ) {
244
286
if ($ is_disabled ) {
0 commit comments