@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at upstream/main 109 lines 2.5 kB view raw
1<?php 2 3final class PhabricatorStandardCustomFieldLink 4 extends PhabricatorStandardCustomField { 5 6 public function getFieldType() { 7 return 'link'; 8 } 9 10 public function buildFieldIndexes() { 11 $indexes = array(); 12 13 $value = $this->getFieldValue(); 14 if (strlen($value)) { 15 $indexes[] = $this->newStringIndex($value); 16 } 17 18 return $indexes; 19 } 20 21 protected function renderValue() { 22 $value = $this->getFieldValue(); 23 24 if (!phutil_nonempty_string($value)) { 25 return null; 26 } 27 28 if (!PhabricatorEnv::isValidRemoteURIForLink($value)) { 29 return $value; 30 } 31 32 return phutil_tag( 33 'a', 34 array( 35 'href' => $value, 36 'target' => '_blank', 37 'rel' => 'noreferrer', 38 ), 39 $value); 40 } 41 42 public function readApplicationSearchValueFromRequest( 43 PhabricatorApplicationSearchEngine $engine, 44 AphrontRequest $request) { 45 46 return $request->getStr($this->getFieldKey()); 47 } 48 49 public function applyApplicationSearchConstraintToQuery( 50 PhabricatorApplicationSearchEngine $engine, 51 PhabricatorCursorPagedPolicyAwareQuery $query, 52 $value) { 53 54 if (is_string($value) && !strlen($value)) { 55 return; 56 } 57 58 $value = (array)$value; 59 if ($value) { 60 $query->withApplicationSearchContainsConstraint( 61 $this->newStringIndex(null), 62 $value); 63 } 64 } 65 66 public function appendToApplicationSearchForm( 67 PhabricatorApplicationSearchEngine $engine, 68 AphrontFormView $form, 69 $value) { 70 71 $form->appendChild( 72 id(new AphrontFormTextControl()) 73 ->setLabel($this->getFieldName()) 74 ->setName($this->getFieldKey()) 75 ->setValue($value)); 76 } 77 78 public function shouldAppearInHerald() { 79 return true; 80 } 81 82 public function getHeraldFieldConditions() { 83 return array( 84 HeraldAdapter::CONDITION_CONTAINS, 85 HeraldAdapter::CONDITION_NOT_CONTAINS, 86 HeraldAdapter::CONDITION_IS, 87 HeraldAdapter::CONDITION_IS_NOT, 88 HeraldAdapter::CONDITION_REGEXP, 89 HeraldAdapter::CONDITION_NOT_REGEXP, 90 ); 91 } 92 93 public function getHeraldFieldStandardType() { 94 return HeraldField::STANDARD_TEXT; 95 } 96 97 protected function getHTTPParameterType() { 98 return new AphrontStringHTTPParameterType(); 99 } 100 101 protected function newConduitSearchParameterType() { 102 return new ConduitStringListParameterType(); 103 } 104 105 protected function newConduitEditParameterType() { 106 return new ConduitStringParameterType(); 107 } 108 109}