3 final class PhabricatorProjectTriggerRemoveProjectsRule
4 extends PhabricatorProjectTriggerRule
{
6 const TRIGGERTYPE
= 'task.projects.remove';
8 public function getSelectControlname() {
9 return pht('Remove project tags');
12 protected function getValueForEditorField() {
13 return $this->getDatasource()->getWireTokens($this->getValue());
16 protected function assertValidRuleRecordFormat($value) {
17 if (!is_array($value)) {
20 'Remove project rule value should be a list, but is not '.
22 phutil_describe_type($value)));
26 protected function assertValidRuleRecordValue($value) {
30 'You must select at least one project tag to remove.'));
34 protected function newDropTransactions($object, $value) {
35 $project_edge_type = PhabricatorProjectObjectHasProjectEdgeType
::EDGECONST
;
37 $xaction = $object->getApplicationTransactionTemplate()
38 ->setTransactionType(PhabricatorTransactions
::TYPE_EDGE
)
39 ->setMetadataValue('edge:type', $project_edge_type)
42 '-' => array_fuse($value),
45 return array($xaction);
48 protected function newDropEffects($value) {
51 ->setIcon('fa-briefcase', 'red')
52 ->setContent($this->getRuleViewDescription($value)),
56 protected function getDefaultValue() {
60 protected function getPHUIXControlType() {
64 private function getDatasource() {
65 return id(new PhabricatorProjectDatasource())
66 ->setViewer($this->getViewer());
69 protected function getPHUIXControlSpecification() {
70 $template = id(new AphrontTokenizerTemplateView())
71 ->setViewer($this->getViewer());
73 $template_markup = $template->render();
74 $datasource = $this->getDatasource();
77 'markup' => (string)hsprintf('%s', $template_markup),
79 'src' => $datasource->getDatasourceURI(),
80 'browseURI' => $datasource->getBrowseURI(),
81 'placeholder' => $datasource->getPlaceholderText(),
82 'limit' => $datasource->getLimit(),
88 public function getRuleViewLabel() {
89 return pht('Remove Project Tags');
92 public function getRuleViewDescription($value) {
94 'Remove project tags: %s.',
99 ->renderHandleList($value)
104 public function getRuleViewIcon($value) {
105 return id(new PHUIIconView())
106 ->setIcon('fa-briefcase', 'red');