Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / nuance / editor / NuanceSourceEditEngine.php
blobeac751c3a5a0cd972923b1782f8f686434754415
1 <?php
3 final class NuanceSourceEditEngine
4 extends PhabricatorEditEngine {
6 const ENGINECONST = 'nuance.source';
8 private $sourceDefinition;
10 public function setSourceDefinition(
11 NuanceSourceDefinition $source_definition) {
12 $this->sourceDefinition = $source_definition;
13 return $this;
16 public function getSourceDefinition() {
17 return $this->sourceDefinition;
20 public function isEngineConfigurable() {
21 return false;
24 public function getEngineName() {
25 return pht('Nuance Sources');
28 public function getSummaryHeader() {
29 return pht('Edit Nuance Source Configurations');
32 public function getSummaryText() {
33 return pht('This engine is used to edit Nuance sources.');
36 public function getEngineApplicationClass() {
37 return 'PhabricatorNuanceApplication';
40 protected function newEditableObject() {
41 $viewer = $this->getViewer();
43 $definition = $this->getSourceDefinition();
44 if (!$definition) {
45 throw new PhutilInvalidStateException('setSourceDefinition');
48 return NuanceSource::initializeNewSource(
49 $viewer,
50 $definition);
53 protected function newObjectQuery() {
54 return new NuanceSourceQuery();
57 protected function getObjectCreateTitleText($object) {
58 return pht('Create Source');
61 protected function getObjectCreateButtonText($object) {
62 return pht('Create Source');
65 protected function getObjectEditTitleText($object) {
66 return pht('Edit Source: %s', $object->getName());
69 protected function getObjectEditShortText($object) {
70 return pht('Edit Source');
73 protected function getObjectCreateShortText() {
74 return pht('Create Source');
77 protected function getObjectName() {
78 return pht('Source');
81 protected function getEditorURI() {
82 return '/nuance/source/edit/';
85 protected function getObjectCreateCancelURI($object) {
86 return '/nuance/source/';
89 protected function getObjectViewURI($object) {
90 return $object->getURI();
93 protected function buildCustomEditFields($object) {
94 return array(
95 id(new PhabricatorTextEditField())
96 ->setKey('name')
97 ->setLabel(pht('Name'))
98 ->setDescription(pht('Name of the source.'))
99 ->setTransactionType(NuanceSourceNameTransaction::TRANSACTIONTYPE)
100 ->setIsRequired(true)
101 ->setValue($object->getName()),
102 id(new PhabricatorDatasourceEditField())
103 ->setKey('defaultQueue')
104 ->setLabel(pht('Default Queue'))
105 ->setDescription(pht('Default queue.'))
106 ->setTransactionType(
107 NuanceSourceDefaultQueueTransaction::TRANSACTIONTYPE)
108 ->setDatasource(new NuanceQueueDatasource())
109 ->setSingleValue($object->getDefaultQueuePHID()),