diff --git a/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php b/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php --- a/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php +++ b/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php @@ -6,6 +6,7 @@ private $customField; private $httpParameterType; private $conduitParameterType; + private $bulkParameterType; public function setCustomField(PhabricatorCustomField $custom_field) { $this->customField = $custom_field; @@ -36,6 +37,16 @@ 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 @@ } 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 @@ 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 --- a/src/infrastructure/customfield/field/PhabricatorCustomField.php +++ b/src/infrastructure/customfield/field/PhabricatorCustomField.php @@ -1119,6 +1119,11 @@ $field->setCustomFieldConduitParameterType($conduit_type); } + $bulk_type = $this->getBulkParameterType(); + if ($bulk_type) { + $field->setCustomFieldBulkParameterType($bulk_type); + } + return $field; } @@ -1133,16 +1138,38 @@ $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 --- a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldTokenizer.php +++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldTokenizer.php @@ -65,6 +65,13 @@ return new ConduitPHIDListParameterType(); } + protected function newBulkParameterType() { + $datasource = $this->getDatasource(); + + return id(new BulkTokenizerParameterType()) + ->setDatasource($datasource); + } + public function shouldAppearInHeraldActions() { return true; }