@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 ManiphestTaskPoints extends Phobject {
4
5 public static function getIsEnabled() {
6 $config = self::getPointsConfig();
7 return idx($config, 'enabled');
8 }
9
10 public static function getPointsLabel() {
11 $config = self::getPointsConfig();
12 return idx($config, 'label', pht('Points'));
13 }
14
15 public static function getPointsActionLabel() {
16 $config = self::getPointsConfig();
17 return idx($config, 'action', pht('Change Points'));
18 }
19
20 private static function getPointsConfig() {
21 return PhabricatorEnv::getEnvConfig('maniphest.points');
22 }
23
24 public static function validateConfiguration($config) {
25 if (!is_array($config)) {
26 throw new Exception(
27 pht(
28 'Configuration is not valid. Maniphest points configuration must '.
29 'be a dictionary.'));
30 }
31
32 PhutilTypeSpec::checkMap(
33 $config,
34 array(
35 'enabled' => 'optional bool',
36 'label' => 'optional string',
37 'action' => 'optional string',
38 ));
39 }
40
41}