Differential D20301 Diff 48499 src/applications/project/trigger/PhabricatorProjectTriggerManiphestStatusRule.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/trigger/PhabricatorProjectTriggerManiphestStatusRule.php
| <?php | <?php | ||||
| final class PhabricatorProjectTriggerManiphestStatusRule | final class PhabricatorProjectTriggerManiphestStatusRule | ||||
| extends PhabricatorProjectTriggerRule { | extends PhabricatorProjectTriggerRule { | ||||
| const TRIGGERTYPE = 'task.status'; | const TRIGGERTYPE = 'task.status'; | ||||
| public function getDescription() { | public function getDescription() { | ||||
| $value = $this->getValue(); | $value = $this->getValue(); | ||||
| return pht( | return pht( | ||||
| 'Changes status to "%s".', | 'Changes status to "%s".', | ||||
| ManiphestTaskStatus::getTaskStatusName($value)); | ManiphestTaskStatus::getTaskStatusName($value)); | ||||
| } | } | ||||
| public function getSelectControlName() { | |||||
| return pht('Change status to'); | |||||
| } | |||||
| protected function assertValidRuleValue($value) { | protected function assertValidRuleValue($value) { | ||||
| if (!is_string($value)) { | if (!is_string($value)) { | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| 'Status rule value should be a string, but is not (value is "%s").', | 'Status rule value should be a string, but is not (value is "%s").', | ||||
| phutil_describe_type($value))); | phutil_describe_type($value))); | ||||
| } | } | ||||
| Show All 27 Lines | return array( | ||||
| $this->newEffect() | $this->newEffect() | ||||
| ->setIcon($status_icon) | ->setIcon($status_icon) | ||||
| ->setColor($status_color) | ->setColor($status_color) | ||||
| ->addCondition('status', '!=', $value) | ->addCondition('status', '!=', $value) | ||||
| ->setContent($content), | ->setContent($content), | ||||
| ); | ); | ||||
| } | } | ||||
| protected function getDefaultValue() { | |||||
| return head_key(ManiphestTaskStatus::getTaskStatusMap()); | |||||
| } | |||||
| protected function getPHUIXControlType() { | |||||
| return 'select'; | |||||
| } | |||||
| protected function getPHUIXControlSpecification() { | |||||
| $map = ManiphestTaskStatus::getTaskStatusMap(); | |||||
| return array( | |||||
| 'options' => $map, | |||||
| 'order' => array_keys($map), | |||||
| ); | |||||
| } | |||||
| } | } | ||||