1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-26 14:38:19 +01:00
phorge-phorge/src/applications/project/herald/HeraldProjectsField.php
epriestley 59c294457f Modularize more Herald fields
Summary: Ref T8726. Continue making Herald fields more modular than they currently are.

Test Plan:
  - Created a rule using all the affected fields.
  - Ran the rule.
  - Saw reasonable object field values.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: eadler, joshuaspence, epriestley

Maniphest Tasks: T8726

Differential Revision: https://secure.phabricator.com/D13495
2015-07-06 13:15:47 -07:00

35 lines
861 B
PHP

<?php
final class HeraldProjectsField extends HeraldField {
const FIELDCONST = 'projects';
public function getHeraldFieldName() {
return pht('Projects');
}
public function supportsObject($object) {
return ($object instanceof PhabricatorProjectInterface);
}
public function getHeraldFieldValue($object) {
return PhabricatorEdgeQuery::loadDestinationPHIDs(
$object->getPHID(),
PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
}
protected function getHeraldFieldStandardConditions() {
return self::STANDARD_LIST;
}
public function getHeraldFieldValueType($condition) {
switch ($condition) {
case HeraldAdapter::CONDITION_EXISTS:
case HeraldAdapter::CONDITION_NOT_EXISTS:
return HeraldAdapter::VALUE_NONE;
default:
return HeraldAdapter::VALUE_PROJECT;
}
}
}