@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorUserConfigOptions
4 extends PhabricatorApplicationConfigOptions {
5
6 public function getName() {
7 return pht('User Profiles');
8 }
9
10 public function getDescription() {
11 return pht('User profiles configuration.');
12 }
13
14 public function getIcon() {
15 return 'fa-users';
16 }
17
18 public function getGroup() {
19 return 'apps';
20 }
21
22 public function getApplicationClassName() {
23 return PhabricatorPeopleApplication::class;
24 }
25
26 public function getOptions() {
27
28 $default = array(
29 id(new PhabricatorUserRealNameField())->getFieldKey() => true,
30 id(new PhabricatorUserTitleField())->getFieldKey() => true,
31 id(new PhabricatorUserIconField())->getFieldKey() => true,
32 id(new PhabricatorUserSinceField())->getFieldKey() => true,
33 id(new PhabricatorUserRolesField())->getFieldKey() => true,
34 id(new PhabricatorUserStatusField())->getFieldKey() => true,
35 id(new PhabricatorUserBlurbField())->getFieldKey() => true,
36 );
37
38 foreach ($default as $key => $enabled) {
39 $default[$key] = array(
40 'disabled' => !$enabled,
41 );
42 }
43
44 $custom_field_type = 'custom:PhabricatorCustomFieldConfigOptionType';
45
46 $fields_description = $this->deformat(pht(<<<EOTEXT
47List of custom fields for user profiles.
48
49For details on adding new fields, see [[ %s | %s ]] in the
50documentation.
51EOTEXT
52 ,
53 PhabricatorEnv::getDoclink('Configuring Custom Fields'),
54 pht('Configuring Custom Fields')));
55
56 return array(
57 $this->newOption('user.fields', $custom_field_type, $default)
58 ->setCustomData(id(new PhabricatorUser())->getCustomFieldBaseClass())
59 ->setDescription(pht('Select and reorder user profile fields.')),
60 $this->newOption('user.custom-field-definitions', 'wild', array())
61 ->setDescription($fields_description),
62 $this->newOption('user.require-real-name', 'bool', true)
63 ->setDescription(pht('Always require real name for user profiles.'))
64 ->setBoolOptions(
65 array(
66 pht('Make real names required'),
67 pht('Make real names optional'),
68 )),
69 );
70 }
71
72}