Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / packages / editor / PhabricatorPackagesVersionEditEngine.php
bloba3c50a886f11c5c7f377d137a1b3d9d25a1c112a
1 <?php
3 final class PhabricatorPackagesVersionEditEngine
4 extends PhabricatorPackagesEditEngine {
6 const ENGINECONST = 'packages.version';
8 public function getEngineName() {
9 return pht('Package Versions');
12 public function getSummaryHeader() {
13 return pht('Edit Package Version Configurations');
16 public function getSummaryText() {
17 return pht('This engine is used to edit Packages versions.');
20 protected function newEditableObject() {
21 $viewer = $this->getViewer();
22 return PhabricatorPackagesVersion::initializeNewVersion($viewer);
25 protected function newObjectQuery() {
26 return new PhabricatorPackagesVersionQuery();
29 protected function getObjectCreateTitleText($object) {
30 return pht('Create Version');
33 protected function getObjectCreateButtonText($object) {
34 return pht('Create Version');
37 protected function getObjectEditTitleText($object) {
38 return pht('Edit Version: %s', $object->getName());
41 protected function getObjectEditShortText($object) {
42 return pht('Edit Version');
45 protected function getObjectCreateShortText() {
46 return pht('Create Version');
49 protected function getObjectName() {
50 return pht('Version');
53 protected function getEditorURI() {
54 return '/packages/version/edit/';
57 protected function getObjectCreateCancelURI($object) {
58 return '/packages/version/';
61 protected function getObjectViewURI($object) {
62 return $object->getURI();
65 protected function buildCustomEditFields($object) {
66 $fields = array();
68 if ($this->getIsCreate()) {
69 $fields[] = id(new PhabricatorDatasourceEditField())
70 ->setKey('package')
71 ->setAliases(array('packagePHID'))
72 ->setLabel(pht('Package'))
73 ->setDescription(pht('Package for this version.'))
74 ->setTransactionType(
75 PhabricatorPackagesVersionPackageTransaction::TRANSACTIONTYPE)
76 ->setIsRequired(true)
77 ->setDatasource(new PhabricatorPackagesPackageDatasource())
78 ->setSingleValue($object->getPackagePHID());
80 $fields[] = id(new PhabricatorTextEditField())
81 ->setKey('name')
82 ->setLabel(pht('Name'))
83 ->setDescription(pht('Name of the version.'))
84 ->setTransactionType(
85 PhabricatorPackagesVersionNameTransaction::TRANSACTIONTYPE)
86 ->setIsRequired(true)
87 ->setValue($object->getName());
90 return $fields;