Path: blob/master/src/applications/badges/editor/PhabricatorBadgesEditEngine.php
12256 views
<?php12final class PhabricatorBadgesEditEngine3extends PhabricatorEditEngine {45const ENGINECONST = 'badges.badge';67public function getEngineName() {8return pht('Badges');9}1011public function getEngineApplicationClass() {12return 'PhabricatorBadgesApplication';13}1415public function getSummaryHeader() {16return pht('Configure Badges Forms');17}1819public function getSummaryText() {20return pht('Configure creation and editing forms in Badges.');21}2223public function isEngineConfigurable() {24return false;25}2627protected function newEditableObject() {28return PhabricatorBadgesBadge::initializeNewBadge($this->getViewer());29}3031protected function newObjectQuery() {32return new PhabricatorBadgesQuery();33}3435protected function getObjectCreateTitleText($object) {36return pht('Create New Badge');37}3839protected function getObjectEditTitleText($object) {40return pht('Edit Badge: %s', $object->getName());41}4243protected function getObjectEditShortText($object) {44return $object->getName();45}4647protected function getObjectCreateShortText() {48return pht('Create Badge');49}5051protected function getObjectName() {52return pht('Badge');53}5455protected function getObjectCreateCancelURI($object) {56return $this->getApplication()->getApplicationURI('/');57}5859protected function getEditorURI() {60return $this->getApplication()->getApplicationURI('edit/');61}6263protected function getCommentViewHeaderText($object) {64return pht('Render Honors');65}6667protected function getCommentViewButtonText($object) {68return pht('Salute');69}7071protected function getObjectViewURI($object) {72return $object->getViewURI();73}7475protected function getCreateNewObjectPolicy() {76return $this->getApplication()->getPolicy(77PhabricatorBadgesCreateCapability::CAPABILITY);78}7980protected function buildCustomEditFields($object) {8182return array(83id(new PhabricatorTextEditField())84->setKey('name')85->setLabel(pht('Name'))86->setDescription(pht('Badge name.'))87->setConduitTypeDescription(pht('New badge name.'))88->setTransactionType(89PhabricatorBadgesBadgeNameTransaction::TRANSACTIONTYPE)90->setValue($object->getName())91->setIsRequired(true),92id(new PhabricatorTextEditField())93->setKey('flavor')94->setLabel(pht('Flavor Text'))95->setDescription(pht('Short description of the badge.'))96->setConduitTypeDescription(pht('New badge flavor.'))97->setValue($object->getFlavor())98->setTransactionType(99PhabricatorBadgesBadgeFlavorTransaction::TRANSACTIONTYPE),100id(new PhabricatorIconSetEditField())101->setKey('icon')102->setLabel(pht('Icon'))103->setIconSet(new PhabricatorBadgesIconSet())104->setTransactionType(105PhabricatorBadgesBadgeIconTransaction::TRANSACTIONTYPE)106->setConduitDescription(pht('Change the badge icon.'))107->setConduitTypeDescription(pht('New badge icon.'))108->setValue($object->getIcon()),109id(new PhabricatorSelectEditField())110->setKey('quality')111->setLabel(pht('Quality'))112->setDescription(pht('Color and rarity of the badge.'))113->setConduitTypeDescription(pht('New badge quality.'))114->setValue($object->getQuality())115->setTransactionType(116PhabricatorBadgesBadgeQualityTransaction::TRANSACTIONTYPE)117->setOptions(PhabricatorBadgesQuality::getDropdownQualityMap()),118id(new PhabricatorRemarkupEditField())119->setKey('description')120->setLabel(pht('Description'))121->setDescription(pht('Badge long description.'))122->setConduitTypeDescription(pht('New badge description.'))123->setTransactionType(124PhabricatorBadgesBadgeDescriptionTransaction::TRANSACTIONTYPE)125->setValue($object->getDescription()),126id(new PhabricatorUsersEditField())127->setKey('award')128->setIsFormField(false)129->setDescription(pht('New badge award recipients.'))130->setConduitTypeDescription(pht('New badge award recipients.'))131->setTransactionType(132PhabricatorBadgesBadgeAwardTransaction::TRANSACTIONTYPE)133->setLabel(pht('Award Recipients')),134id(new PhabricatorUsersEditField())135->setKey('revoke')136->setIsFormField(false)137->setDescription(pht('Revoke badge award recipients.'))138->setConduitTypeDescription(pht('Revoke badge award recipients.'))139->setTransactionType(140PhabricatorBadgesBadgeRevokeTransaction::TRANSACTIONTYPE)141->setLabel(pht('Revoke Recipients')),142143);144}145146}147148149