Generate file attachment transactions for explicit Remarkup attachments on common...
[phabricator.git] / src / applications / differential / field / DifferentialTitleCommitMessageField.php
blob6b39796f3aebf970664c957e6c954a886354f792
1 <?php
3 final class DifferentialTitleCommitMessageField
4 extends DifferentialCommitMessageField {
6 const FIELDKEY = 'title';
8 public function getFieldName() {
9 return pht('Title');
12 public function getFieldOrder() {
13 return 1000;
16 public static function getDefaultTitle() {
17 return pht('<<Replace this line with your revision title>');
20 public function parseFieldValue($value) {
21 if ($value === self::getDefaultTitle()) {
22 $this->raiseParseException(
23 pht(
24 'Replace the default title line with a human-readable revision '.
25 'title which describes the changes you are making.'));
28 return parent::parseFieldValue($value);
31 public function validateFieldValue($value) {
32 if (!strlen($value)) {
33 $this->raiseValidationException(
34 pht(
35 'You must provide a revision title in the first line '.
36 'of your commit message.'));
40 public function readFieldValueFromObject(DifferentialRevision $revision) {
41 $value = $revision->getTitle();
43 if (!strlen($value)) {
44 return self::getDefaultTitle();
47 return $value;
50 public function getFieldTransactions($value) {
51 return array(
52 array(
53 'type' => DifferentialRevisionTitleTransaction::EDITKEY,
54 'value' => $value,