Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14025506
D12543.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D12543.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2544,6 +2544,7 @@
'PhabricatorStandardCustomFieldHeader' => 'infrastructure/customfield/standard/PhabricatorStandardCustomFieldHeader.php',
'PhabricatorStandardCustomFieldInt' => 'infrastructure/customfield/standard/PhabricatorStandardCustomFieldInt.php',
'PhabricatorStandardCustomFieldInterface' => 'infrastructure/customfield/interface/PhabricatorStandardCustomFieldInterface.php',
+ 'PhabricatorStandardCustomFieldLink' => 'infrastructure/customfield/standard/PhabricatorStandardCustomFieldLink.php',
'PhabricatorStandardCustomFieldPHIDs' => 'infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php',
'PhabricatorStandardCustomFieldRemarkup' => 'infrastructure/customfield/standard/PhabricatorStandardCustomFieldRemarkup.php',
'PhabricatorStandardCustomFieldSelect' => 'infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php',
@@ -5971,6 +5972,7 @@
'PhabricatorStandardCustomFieldDate' => 'PhabricatorStandardCustomField',
'PhabricatorStandardCustomFieldHeader' => 'PhabricatorStandardCustomField',
'PhabricatorStandardCustomFieldInt' => 'PhabricatorStandardCustomField',
+ 'PhabricatorStandardCustomFieldLink' => 'PhabricatorStandardCustomField',
'PhabricatorStandardCustomFieldPHIDs' => 'PhabricatorStandardCustomField',
'PhabricatorStandardCustomFieldRemarkup' => 'PhabricatorStandardCustomField',
'PhabricatorStandardCustomFieldSelect' => 'PhabricatorStandardCustomField',
diff --git a/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldLink.php b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldLink.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldLink.php
@@ -0,0 +1,84 @@
+<?php
+
+final class PhabricatorStandardCustomFieldLink
+ extends PhabricatorStandardCustomField {
+
+ public function getFieldType() {
+ return 'link';
+ }
+
+ public function buildFieldIndexes() {
+ $indexes = array();
+
+ $value = $this->getFieldValue();
+ if (strlen($value)) {
+ $indexes[] = $this->newStringIndex($value);
+ }
+
+ return $indexes;
+ }
+
+ public function renderPropertyViewValue(array $handles) {
+ $value = $this->getFieldValue();
+
+ if (!strlen($value)) {
+ return null;
+ }
+
+ if (!PhabricatorEnv::isValidRemoteURIForLink($value)) {
+ return $value;
+ }
+
+ return phutil_tag(
+ 'a',
+ array('href' => $value, 'target' => '_blank'),
+ $value);
+ }
+
+ public function readApplicationSearchValueFromRequest(
+ PhabricatorApplicationSearchEngine $engine,
+ AphrontRequest $request) {
+
+ return $request->getStr($this->getFieldKey());
+ }
+
+ public function applyApplicationSearchConstraintToQuery(
+ PhabricatorApplicationSearchEngine $engine,
+ PhabricatorCursorPagedPolicyAwareQuery $query,
+ $value) {
+
+ if (strlen($value)) {
+ $query->withApplicationSearchContainsConstraint(
+ $this->newStringIndex(null),
+ $value);
+ }
+ }
+
+ public function appendToApplicationSearchForm(
+ PhabricatorApplicationSearchEngine $engine,
+ AphrontFormView $form,
+ $value,
+ array $handles) {
+
+ $form->appendChild(
+ id(new AphrontFormTextControl())
+ ->setLabel($this->getFieldName())
+ ->setName($this->getFieldKey())
+ ->setValue($value));
+ }
+
+ public function shouldAppearInHerald() {
+ return true;
+ }
+
+ public function getHeraldFieldConditions() {
+ return array(
+ HeraldAdapter::CONDITION_CONTAINS,
+ HeraldAdapter::CONDITION_NOT_CONTAINS,
+ HeraldAdapter::CONDITION_IS,
+ HeraldAdapter::CONDITION_IS_NOT,
+ HeraldAdapter::CONDITION_REGEXP,
+ );
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 8, 6:41 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6712176
Default Alt Text
D12543.diff (3 KB)
Attached To
Mode
D12543: Add link custom field.
Attached
Detach File
Event Timeline
Log In to Comment