3 final class PhabricatorBadgesEditEngine
4 extends PhabricatorEditEngine
{
6 const ENGINECONST
= 'badges.badge';
8 public function getEngineName() {
12 public function getEngineApplicationClass() {
13 return 'PhabricatorBadgesApplication';
16 public function getSummaryHeader() {
17 return pht('Configure Badges Forms');
20 public function getSummaryText() {
21 return pht('Configure creation and editing forms in Badges.');
24 public function isEngineConfigurable() {
28 protected function newEditableObject() {
29 return PhabricatorBadgesBadge
::initializeNewBadge($this->getViewer());
32 protected function newObjectQuery() {
33 return new PhabricatorBadgesQuery();
36 protected function getObjectCreateTitleText($object) {
37 return pht('Create New Badge');
40 protected function getObjectEditTitleText($object) {
41 return pht('Edit Badge: %s', $object->getName());
44 protected function getObjectEditShortText($object) {
45 return $object->getName();
48 protected function getObjectCreateShortText() {
49 return pht('Create Badge');
52 protected function getObjectName() {
56 protected function getObjectCreateCancelURI($object) {
57 return $this->getApplication()->getApplicationURI('/');
60 protected function getEditorURI() {
61 return $this->getApplication()->getApplicationURI('edit/');
64 protected function getCommentViewHeaderText($object) {
65 return pht('Render Honors');
68 protected function getCommentViewButtonText($object) {
72 protected function getObjectViewURI($object) {
73 return $object->getViewURI();
76 protected function getCreateNewObjectPolicy() {
77 return $this->getApplication()->getPolicy(
78 PhabricatorBadgesCreateCapability
::CAPABILITY
);
81 protected function buildCustomEditFields($object) {
84 id(new PhabricatorTextEditField())
86 ->setLabel(pht('Name'))
87 ->setDescription(pht('Badge name.'))
88 ->setConduitTypeDescription(pht('New badge name.'))
90 PhabricatorBadgesBadgeNameTransaction
::TRANSACTIONTYPE
)
91 ->setValue($object->getName())
92 ->setIsRequired(true),
93 id(new PhabricatorTextEditField())
95 ->setLabel(pht('Flavor Text'))
96 ->setDescription(pht('Short description of the badge.'))
97 ->setConduitTypeDescription(pht('New badge flavor.'))
98 ->setValue($object->getFlavor())
100 PhabricatorBadgesBadgeFlavorTransaction
::TRANSACTIONTYPE
),
101 id(new PhabricatorIconSetEditField())
103 ->setLabel(pht('Icon'))
104 ->setIconSet(new PhabricatorBadgesIconSet())
105 ->setTransactionType(
106 PhabricatorBadgesBadgeIconTransaction
::TRANSACTIONTYPE
)
107 ->setConduitDescription(pht('Change the badge icon.'))
108 ->setConduitTypeDescription(pht('New badge icon.'))
109 ->setValue($object->getIcon()),
110 id(new PhabricatorSelectEditField())
112 ->setLabel(pht('Quality'))
113 ->setDescription(pht('Color and rarity of the badge.'))
114 ->setConduitTypeDescription(pht('New badge quality.'))
115 ->setValue($object->getQuality())
116 ->setTransactionType(
117 PhabricatorBadgesBadgeQualityTransaction
::TRANSACTIONTYPE
)
118 ->setOptions(PhabricatorBadgesQuality
::getDropdownQualityMap()),
119 id(new PhabricatorRemarkupEditField())
120 ->setKey('description')
121 ->setLabel(pht('Description'))
122 ->setDescription(pht('Badge long description.'))
123 ->setConduitTypeDescription(pht('New badge description.'))
124 ->setTransactionType(
125 PhabricatorBadgesBadgeDescriptionTransaction
::TRANSACTIONTYPE
)
126 ->setValue($object->getDescription()),
127 id(new PhabricatorUsersEditField())
129 ->setIsFormField(false)
130 ->setDescription(pht('New badge award recipients.'))
131 ->setConduitTypeDescription(pht('New badge award recipients.'))
132 ->setTransactionType(
133 PhabricatorBadgesBadgeAwardTransaction
::TRANSACTIONTYPE
)
134 ->setLabel(pht('Award Recipients')),
135 id(new PhabricatorUsersEditField())
137 ->setIsFormField(false)
138 ->setDescription(pht('Revoke badge award recipients.'))
139 ->setConduitTypeDescription(pht('Revoke badge award recipients.'))
140 ->setTransactionType(
141 PhabricatorBadgesBadgeRevokeTransaction
::TRANSACTIONTYPE
)
142 ->setLabel(pht('Revoke Recipients')),