@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 PhabricatorCountdownEditEngine
4 extends PhabricatorEditEngine {
5
6 const ENGINECONST = 'countdown.countdown';
7
8 public function isEngineConfigurable() {
9 return false;
10 }
11
12 public function getEngineName() {
13 return pht('Countdowns');
14 }
15
16 public function getSummaryHeader() {
17 return pht('Edit Countdowns');
18 }
19
20 public function getSummaryText() {
21 return pht('Creates and edits countdowns.');
22 }
23
24 public function getEngineApplicationClass() {
25 return PhabricatorCountdownApplication::class;
26 }
27
28 protected function newEditableObject() {
29 return PhabricatorCountdown::initializeNewCountdown(
30 $this->getViewer());
31 }
32
33 protected function newObjectQuery() {
34 return id(new PhabricatorCountdownQuery());
35 }
36
37 protected function getObjectCreateTitleText($object) {
38 return pht('Create Countdown');
39 }
40
41 protected function getObjectCreateButtonText($object) {
42 return pht('Create Countdown');
43 }
44
45 protected function getObjectEditTitleText($object) {
46 return pht('Edit Countdown: %s', $object->getTitle());
47 }
48
49 protected function getObjectEditShortText($object) {
50 return pht('Edit Countdown');
51 }
52
53 protected function getObjectCreateShortText() {
54 return pht('Create Countdown');
55 }
56
57 protected function getObjectName() {
58 return pht('Countdown');
59 }
60
61 protected function getCommentViewHeaderText($object) {
62 return pht('Last Words');
63 }
64
65 protected function getCommentViewButtonText($object) {
66 return pht('Contemplate Infinity');
67 }
68
69 protected function getObjectViewURI($object) {
70 return $object->getURI();
71 }
72
73 protected function getCreateNewObjectPolicy() {
74 return $this->getApplication()->getPolicy(
75 PhabricatorCountdownCreateCapability::CAPABILITY);
76 }
77
78 protected function buildCustomEditFields($object) {
79 $epoch_value = $object->getEpoch();
80 if ($epoch_value === null) {
81 $epoch_value = PhabricatorTime::getNow();
82 }
83
84 return array(
85 id(new PhabricatorTextEditField())
86 ->setKey('name')
87 ->setLabel(pht('Name'))
88 ->setIsRequired(true)
89 ->setTransactionType(
90 PhabricatorCountdownTitleTransaction::TRANSACTIONTYPE)
91 ->setDescription(pht('The countdown name.'))
92 ->setConduitDescription(pht('Rename the countdown.'))
93 ->setConduitTypeDescription(pht('New countdown name.'))
94 ->setValue($object->getTitle()),
95 id(new PhabricatorEpochEditField())
96 ->setKey('epoch')
97 ->setLabel(pht('End Date'))
98 ->setTransactionType(
99 PhabricatorCountdownEpochTransaction::TRANSACTIONTYPE)
100 ->setDescription(pht('Date when the countdown ends.'))
101 ->setConduitDescription(pht('Change the end date of the countdown.'))
102 ->setConduitTypeDescription(pht('New countdown end date.'))
103 ->setValue($epoch_value),
104 id(new PhabricatorRemarkupEditField())
105 ->setKey('description')
106 ->setLabel(pht('Description'))
107 ->setTransactionType(
108 PhabricatorCountdownDescriptionTransaction::TRANSACTIONTYPE)
109 ->setDescription(pht('Description of the countdown.'))
110 ->setConduitDescription(pht('Change the countdown description.'))
111 ->setConduitTypeDescription(pht('New description.'))
112 ->setValue($object->getDescription()),
113 );
114 }
115
116}