Differential D20417 Diff 48761 src/applications/project/trigger/PhabricatorProjectTriggerRemoveProjectsRule.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/trigger/PhabricatorProjectTriggerRemoveProjectsRule.php
<?php | <?php | ||||
final class PhabricatorProjectTriggerRemoveProjectsRule | final class PhabricatorProjectTriggerRemoveProjectsRule | ||||
extends PhabricatorProjectTriggerRule { | extends PhabricatorProjectTriggerRule { | ||||
const TRIGGERTYPE = 'task.projects.remove'; | const TRIGGERTYPE = 'task.projects.remove'; | ||||
public function getSelectControLname() { | public function getSelectControlname() { | ||||
return pht('Remove projects'); | return pht('Remove project tags'); | ||||
} | } | ||||
protected function getValueForEditorField() { | protected function getValueForEditorField() { | ||||
return $this->getDatasource()->getWireTokens($this->getValue()); | return $this->getDatasource()->getWireTokens($this->getValue()); | ||||
} | } | ||||
protected function assertValidRuleValue($value) { | protected function assertValidRuleRecordFormat($value) { | ||||
if (!is_array($value)) { | if (!is_array($value)) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Remove project rule value should be a list, but is not '. | 'Remove project rule value should be a list, but is not '. | ||||
'(value is "%s").', | '(value is "%s").', | ||||
phutil_describe_type($value))); | phutil_describe_type($value))); | ||||
} | } | ||||
} | } | ||||
protected function assertValidRuleRecordValue($value) { | |||||
if (!$value) { | |||||
throw new Exception( | |||||
pht( | |||||
'You must select at least one project tag to remove.')); | |||||
} | |||||
} | |||||
protected function newDropTransactions($object, $value) { | protected function newDropTransactions($object, $value) { | ||||
$project_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; | $project_edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; | ||||
$xaction = $object->getApplicationTransactionTemplate() | $xaction = $object->getApplicationTransactionTemplate() | ||||
->setTransactionType(PhabricatorTransactions::TYPE_EDGE) | ->setTransactionType(PhabricatorTransactions::TYPE_EDGE) | ||||
->setMetadataValue('edge:type', $project_edge_type) | ->setMetadataValue('edge:type', $project_edge_type) | ||||
->setNewValue( | ->setNewValue( | ||||
array( | array( | ||||
Show All 39 Lines | return array( | ||||
'placeholder' => $datasource->getPlaceholderText(), | 'placeholder' => $datasource->getPlaceholderText(), | ||||
'limit' => $datasource->getLimit(), | 'limit' => $datasource->getLimit(), | ||||
), | ), | ||||
'value' => null, | 'value' => null, | ||||
); | ); | ||||
} | } | ||||
public function getRuleViewLabel() { | public function getRuleViewLabel() { | ||||
return pht('Remove Projects'); | return pht('Remove Project Tags'); | ||||
} | } | ||||
public function getRuleViewDescription($value) { | public function getRuleViewDescription($value) { | ||||
return pht( | return pht( | ||||
'Remove projects: %s.', | 'Remove project tags: %s.', | ||||
phutil_tag( | phutil_tag( | ||||
'strong', | 'strong', | ||||
array(), | array(), | ||||
$this->getViewer() | $this->getViewer() | ||||
->renderHandleList($value) | ->renderHandleList($value) | ||||
->setAsInline(true) | ->setAsInline(true) | ||||
->render())); | ->render())); | ||||
} | } | ||||
Show All 9 Lines |