diff --git a/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php b/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php index ffdb157d8e..1153f82a34 100644 --- a/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php +++ b/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php @@ -6,6 +6,7 @@ final class PhabricatorCustomFieldEditField private $customField; private $httpParameterType; private $conduitParameterType; + private $bulkParameterType; public function setCustomField(PhabricatorCustomField $custom_field) { $this->customField = $custom_field; @@ -36,6 +37,16 @@ final class PhabricatorCustomFieldEditField return $this->conduitParameterType; } + public function setCustomFieldBulkParameterType( + BulkParameterType $type) { + $this->bulkParameterType = $type; + return $this; + } + + public function getCustomFieldBulkParameterType() { + return $this->bulkParameterType; + } + protected function buildControl() { if ($this->getIsConduitOnly()) { return null; @@ -51,15 +62,8 @@ final class PhabricatorCustomFieldEditField } protected function newEditType() { - $type = id(new PhabricatorCustomFieldEditType()) + return id(new PhabricatorCustomFieldEditType()) ->setCustomField($this->getCustomField()); - - $conduit_type = $this->newConduitParameterType(); - if ($conduit_type) { - $type->setConduitParameterType($conduit_type); - } - - return $type; } public function getValueForTransaction() { @@ -116,6 +120,16 @@ final class PhabricatorCustomFieldEditField return null; } + protected function newBulkParameterType() { + $type = $this->getCustomFieldBulkParameterType(); + + if ($type) { + return clone $type; + } + + return null; + } + public function getAllReadValueFromRequestKeys() { $keys = array(); diff --git a/src/infrastructure/customfield/field/PhabricatorCustomField.php b/src/infrastructure/customfield/field/PhabricatorCustomField.php index f7f4403402..c96f09f369 100644 --- a/src/infrastructure/customfield/field/PhabricatorCustomField.php +++ b/src/infrastructure/customfield/field/PhabricatorCustomField.php @@ -1119,6 +1119,11 @@ abstract class PhabricatorCustomField extends Phobject { $field->setCustomFieldConduitParameterType($conduit_type); } + $bulk_type = $this->getBulkParameterType(); + if ($bulk_type) { + $field->setCustomFieldBulkParameterType($bulk_type); + } + return $field; } @@ -1133,16 +1138,38 @@ abstract class PhabricatorCustomField extends Phobject { $conduit_only = false; } + $bulk_label = $this->getBulkEditLabel(); + return $this->newEditField() ->setKey($this->getFieldKey()) ->setEditTypeKey($this->getModernFieldKey()) ->setLabel($this->getFieldName()) + ->setBulkEditLabel($bulk_label) ->setDescription($this->getFieldDescription()) ->setTransactionType($this->getApplicationTransactionType()) ->setIsConduitOnly($conduit_only) ->setValue($this->getNewValueForApplicationTransactions()); } + protected function getBulkEditLabel() { + if ($this->proxy) { + return $this->proxy->getBulkEditLabel(); + } + + return pht('Set "%s" to', $this->getFieldName()); + } + + public function getBulkParameterType() { + return $this->newBulkParameterType(); + } + + protected function newBulkParameterType() { + if ($this->proxy) { + return $this->proxy->newBulkParameterType(); + } + return null; + } + protected function getHTTPParameterType() { if ($this->proxy) { return $this->proxy->getHTTPParameterType(); diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldTokenizer.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldTokenizer.php index 9cb19d029d..5c5f422375 100644 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldTokenizer.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldTokenizer.php @@ -65,6 +65,13 @@ abstract class PhabricatorStandardCustomFieldTokenizer return new ConduitPHIDListParameterType(); } + protected function newBulkParameterType() { + $datasource = $this->getDatasource(); + + return id(new BulkTokenizerParameterType()) + ->setDatasource($datasource); + } + public function shouldAppearInHeraldActions() { return true; }