Path: blob/master/src/applications/herald/editor/HeraldWebhookEditEngine.php
12256 views
<?php12final class HeraldWebhookEditEngine3extends PhabricatorEditEngine {45const ENGINECONST = 'herald.webhook';67public function isEngineConfigurable() {8return false;9}1011public function getEngineName() {12return pht('Webhooks');13}1415public function getSummaryHeader() {16return pht('Edit Webhook Configurations');17}1819public function getSummaryText() {20return pht('This engine is used to edit webhooks.');21}2223public function getEngineApplicationClass() {24return 'PhabricatorHeraldApplication';25}2627protected function newEditableObject() {28$viewer = $this->getViewer();29return HeraldWebhook::initializeNewWebhook($viewer);30}3132protected function newObjectQuery() {33return new HeraldWebhookQuery();34}3536protected function getObjectCreateTitleText($object) {37return pht('Create Webhook');38}3940protected function getObjectCreateButtonText($object) {41return pht('Create Webhook');42}4344protected function getObjectEditTitleText($object) {45return pht('Edit Webhook: %s', $object->getName());46}4748protected function getObjectEditShortText($object) {49return pht('Edit Webhook');50}5152protected function getObjectCreateShortText() {53return pht('Create Webhook');54}5556protected function getObjectName() {57return pht('Webhook');58}5960protected function getEditorURI() {61return '/herald/webhook/edit/';62}6364protected function getObjectCreateCancelURI($object) {65return '/herald/webhook/';66}6768protected function getObjectViewURI($object) {69return $object->getURI();70}7172protected function getCreateNewObjectPolicy() {73return $this->getApplication()->getPolicy(74HeraldCreateWebhooksCapability::CAPABILITY);75}7677protected function buildCustomEditFields($object) {78return array(79id(new PhabricatorTextEditField())80->setKey('name')81->setLabel(pht('Name'))82->setDescription(pht('Name of the webhook.'))83->setTransactionType(HeraldWebhookNameTransaction::TRANSACTIONTYPE)84->setIsRequired(true)85->setValue($object->getName()),86id(new PhabricatorTextEditField())87->setKey('uri')88->setLabel(pht('URI'))89->setDescription(pht('URI for the webhook.'))90->setTransactionType(HeraldWebhookURITransaction::TRANSACTIONTYPE)91->setIsRequired(true)92->setValue($object->getWebhookURI()),93id(new PhabricatorSelectEditField())94->setKey('status')95->setLabel(pht('Status'))96->setDescription(pht('Status mode for the webhook.'))97->setTransactionType(HeraldWebhookStatusTransaction::TRANSACTIONTYPE)98->setOptions(HeraldWebhook::getStatusDisplayNameMap())99->setValue($object->getStatus()),100101);102}103104}105106107