Page MenuHomePhabricator

WarningCustomField.php

Authored By
epriestley
Feb 23 2016, 4:15 PM
Size
888 B
Referenced Files
None
Subscribers
None

WarningCustomField.php

<?php
final class WarningCustomField extends DifferentialCustomField {
public function getFieldKey() {
return 'mycompany:mycustomfield';
}
public function shouldAppearInPropertyView() {
// This is required or the field won't be loaded on the detail page.
return true;
}
public function renderPropertyViewValue(array $handles) {
// This prevents it from actually rendering a property.
return null;
}
public function getWarningsForRevisionHeader(array $handles) {
$revision = $this->getObject();
// Do some magic here to figure out if the branch the revision will land
// onto is bad.
$is_bad = some_magic($revision);
$warnings = array();
if ($is_bad) {
$warnings[] = pht(
'IMPORTANT! The branch this revision is targeting has a broken '.
'build!');
}
return $warnings;
}
}

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
61220
Default Alt Text
WarningCustomField.php (888 B)

Event Timeline