Changeset View
Changeset View
Standalone View
Standalone View
src/applications/macro/editor/PhabricatorMacroEditEngine.php
Show All 15 Lines | final class PhabricatorMacroEditEngine | ||||
public function getSummaryText() { | public function getSummaryText() { | ||||
return pht('Configure creation and editing of Macro images.'); | return pht('Configure creation and editing of Macro images.'); | ||||
} | } | ||||
public function getEngineApplicationClass() { | public function getEngineApplicationClass() { | ||||
return 'PhabricatorMacroApplication'; | return 'PhabricatorMacroApplication'; | ||||
} | } | ||||
public function isEngineConfigurable() { | |||||
return false; | |||||
} | |||||
protected function newEditableObject() { | protected function newEditableObject() { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
return PhabricatorFileImageMacro::initializeNewFileImageMacro($viewer); | return PhabricatorFileImageMacro::initializeNewFileImageMacro($viewer); | ||||
} | } | ||||
protected function newObjectQuery() { | protected function newObjectQuery() { | ||||
return new PhabricatorMacroQuery(); | return new PhabricatorMacroQuery(); | ||||
} | } | ||||
protected function getObjectCreateTitleText($object) { | protected function getObjectCreateTitleText($object) { | ||||
return pht('Create New Macro'); | return pht('Create New Macro'); | ||||
} | } | ||||
protected function getObjectEditTitleText($object) { | protected function getObjectEditTitleText($object) { | ||||
return pht('Edit %s', $object->getName()); | return pht('Edit Macro %s', $object->getName()); | ||||
} | } | ||||
protected function getObjectEditShortText($object) { | protected function getObjectEditShortText($object) { | ||||
return $object->getName(); | return $object->getName(); | ||||
} | } | ||||
protected function getObjectCreateShortText() { | protected function getObjectCreateShortText() { | ||||
return pht('Create Macro'); | return pht('Create Macro'); | ||||
Show All 11 Lines | protected function getEditorURI() { | ||||
return $this->getApplication()->getApplicationURI('edit/'); | return $this->getApplication()->getApplicationURI('edit/'); | ||||
} | } | ||||
protected function getCreateNewObjectPolicy() { | protected function getCreateNewObjectPolicy() { | ||||
return $this->getApplication()->getPolicy( | return $this->getApplication()->getPolicy( | ||||
PhabricatorMacroManageCapability::CAPABILITY); | PhabricatorMacroManageCapability::CAPABILITY); | ||||
} | } | ||||
protected function willConfigureFields($object, array $fields) { | |||||
if ($this->getIsCreate()) { | |||||
$subscribers_field = idx($fields, | |||||
PhabricatorSubscriptionsEditEngineExtension::FIELDKEY); | |||||
if ($subscribers_field) { | |||||
// By default, hide the subscribers field when creating a macro | |||||
// because it makes the workflow SO HARD and wastes SO MUCH TIME. | |||||
epriestley: GREAT comment A+++ | |||||
$subscribers_field->setIsHidden(true); | |||||
} | |||||
} | |||||
return $fields; | |||||
} | |||||
protected function buildCustomEditFields($object) { | protected function buildCustomEditFields($object) { | ||||
return array( | return array( | ||||
id(new PhabricatorTextEditField()) | id(new PhabricatorTextEditField()) | ||||
->setKey('name') | ->setKey('name') | ||||
->setLabel(pht('Name')) | ->setLabel(pht('Name')) | ||||
->setDescription(pht('Macro name.')) | ->setDescription(pht('Macro name.')) | ||||
->setConduitDescription(pht('Rename the macro.')) | ->setConduitDescription(pht('Rename the macro.')) | ||||
->setConduitTypeDescription(pht('New macro name.')) | ->setConduitTypeDescription(pht('New macro name.')) | ||||
->setTransactionType(PhabricatorMacroNameTransaction::TRANSACTIONTYPE) | ->setTransactionType(PhabricatorMacroNameTransaction::TRANSACTIONTYPE) | ||||
->setIsRequired(true) | |||||
->setValue($object->getName()), | ->setValue($object->getName()), | ||||
id(new PhabricatorFileEditField()) | id(new PhabricatorFileEditField()) | ||||
->setKey('filePHID') | ->setKey('filePHID') | ||||
->setLabel(pht('Image File')) | ->setLabel(pht('Image File')) | ||||
->setDescription(pht('Image file to import.')) | ->setDescription(pht('Image file to import.')) | ||||
->setTransactionType(PhabricatorMacroFileTransaction::TRANSACTIONTYPE) | ->setTransactionType(PhabricatorMacroFileTransaction::TRANSACTIONTYPE) | ||||
->setConduitDescription(pht('File PHID to import.')) | ->setConduitDescription(pht('File PHID to import.')) | ||||
->setConduitTypeDescription(pht('File PHID.')), | ->setConduitTypeDescription(pht('File PHID.')) | ||||
->setValue($object->getFilePHID()), | |||||
); | ); | ||||
} | } | ||||
} | } |
GREAT comment A+++