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;
16 public function getSourceDefinition() {
17 return $this->sourceDefinition
;
20 public function isEngineConfigurable() {
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();
45 throw new PhutilInvalidStateException('setSourceDefinition');
48 return NuanceSource
::initializeNewSource(
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() {
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) {
95 id(new PhabricatorTextEditField())
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()),