Differential D19852 Diff 47411 src/applications/transactions/engineextension/PhabricatorSubtypeEditEngineExtension.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/engineextension/PhabricatorSubtypeEditEngineExtension.php
Show All 25 Lines | final class PhabricatorSubtypeEditEngineExtension | ||||
public function buildCustomEditFields( | public function buildCustomEditFields( | ||||
PhabricatorEditEngine $engine, | PhabricatorEditEngine $engine, | ||||
PhabricatorApplicationTransactionInterface $object) { | PhabricatorApplicationTransactionInterface $object) { | ||||
$subtype_type = PhabricatorTransactions::TYPE_SUBTYPE; | $subtype_type = PhabricatorTransactions::TYPE_SUBTYPE; | ||||
$map = $object->newEditEngineSubtypeMap(); | $map = $object->newEditEngineSubtypeMap(); | ||||
$options = mpull($map, 'getName'); | $options = $map->getDisplayMap(); | ||||
$subtype_field = id(new PhabricatorSelectEditField()) | $subtype_field = id(new PhabricatorSelectEditField()) | ||||
->setKey(self::EDITKEY) | ->setKey(self::EDITKEY) | ||||
->setLabel(pht('Subtype')) | ->setLabel(pht('Subtype')) | ||||
->setIsFormField(false) | ->setIsFormField(false) | ||||
->setTransactionType($subtype_type) | ->setTransactionType($subtype_type) | ||||
->setConduitDescription(pht('Change the object subtype.')) | ->setConduitDescription(pht('Change the object subtype.')) | ||||
->setConduitTypeDescription(pht('New object subtype key.')) | ->setConduitTypeDescription(pht('New object subtype key.')) | ||||
->setValue($object->getEditEngineSubtype()) | ->setValue($object->getEditEngineSubtype()) | ||||
->setOptions($options); | ->setOptions($options); | ||||
// If subtypes are configured, enable changing them from the bulk editor | // If subtypes are configured, enable changing them from the bulk editor | ||||
// and comment action stack. | // and comment action stack. | ||||
if (count($map) > 1) { | if ($map->getCount() > 1) { | ||||
$subtype_field | $subtype_field | ||||
->setBulkEditLabel(pht('Change subtype to')) | ->setBulkEditLabel(pht('Change subtype to')) | ||||
->setCommentActionLabel(pht('Change Subtype')) | ->setCommentActionLabel(pht('Change Subtype')) | ||||
->setCommentActionOrder(3000); | ->setCommentActionOrder(3000); | ||||
} | } | ||||
return array( | return array( | ||||
$subtype_field, | $subtype_field, | ||||
); | ); | ||||
} | } | ||||
} | } |