Path: blob/master/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldLink.php
12242 views
<?php12final class PhabricatorStandardCustomFieldLink3extends PhabricatorStandardCustomField {45public function getFieldType() {6return 'link';7}89public function buildFieldIndexes() {10$indexes = array();1112$value = $this->getFieldValue();13if (strlen($value)) {14$indexes[] = $this->newStringIndex($value);15}1617return $indexes;18}1920public function renderPropertyViewValue(array $handles) {21$value = $this->getFieldValue();2223if (!strlen($value)) {24return null;25}2627if (!PhabricatorEnv::isValidRemoteURIForLink($value)) {28return $value;29}3031return phutil_tag(32'a',33array(34'href' => $value,35'target' => '_blank',36'rel' => 'noreferrer',37),38$value);39}4041public function readApplicationSearchValueFromRequest(42PhabricatorApplicationSearchEngine $engine,43AphrontRequest $request) {4445return $request->getStr($this->getFieldKey());46}4748public function applyApplicationSearchConstraintToQuery(49PhabricatorApplicationSearchEngine $engine,50PhabricatorCursorPagedPolicyAwareQuery $query,51$value) {5253if (is_string($value) && !strlen($value)) {54return;55}5657$value = (array)$value;58if ($value) {59$query->withApplicationSearchContainsConstraint(60$this->newStringIndex(null),61$value);62}63}6465public function appendToApplicationSearchForm(66PhabricatorApplicationSearchEngine $engine,67AphrontFormView $form,68$value) {6970$form->appendChild(71id(new AphrontFormTextControl())72->setLabel($this->getFieldName())73->setName($this->getFieldKey())74->setValue($value));75}7677public function shouldAppearInHerald() {78return true;79}8081public function getHeraldFieldConditions() {82return array(83HeraldAdapter::CONDITION_CONTAINS,84HeraldAdapter::CONDITION_NOT_CONTAINS,85HeraldAdapter::CONDITION_IS,86HeraldAdapter::CONDITION_IS_NOT,87HeraldAdapter::CONDITION_REGEXP,88HeraldAdapter::CONDITION_NOT_REGEXP,89);90}9192public function getHeraldFieldStandardType() {93return HeraldField::STANDARD_TEXT;94}9596protected function getHTTPParameterType() {97return new AphrontStringHTTPParameterType();98}99100protected function newConduitSearchParameterType() {101return new ConduitStringListParameterType();102}103104protected function newConduitEditParameterType() {105return new ConduitStringParameterType();106}107108}109110111