Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2711548
D25231.1735411492.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
D25231.1735411492.diff
View Options
diff --git a/src/view/form/control/AphrontFormControl.php b/src/view/form/control/AphrontFormControl.php
--- a/src/view/form/control/AphrontFormControl.php
+++ b/src/view/form/control/AphrontFormControl.php
@@ -56,11 +56,22 @@
return $this->label;
}
+ /**
+ * Set the Caption
+ * The Caption shows a tip usually nearby the related input field.
+ * @param string|PhutilSafeHTML|null
+ * @return self
+ */
public function setCaption($caption) {
$this->caption = $caption;
return $this;
}
+ /**
+ * Get the Caption
+ * The Caption shows a tip usually nearby the related input field.
+ * @return string|PhutilSafeHTML|null
+ */
public function getCaption() {
return $this->caption;
}
@@ -203,11 +214,18 @@
$custom_class .= ' aphront-form-control-nolabel';
}
- if (phutil_nonempty_string($this->getCaption())) {
+ // The Caption is a tip usually shown below the input box
+ $caption_content = $this->getCaption();
+
+ // The Caption can be stuff like PhutilSafeHTML and other objects that
+ // can be casted to a string. After this cast we have never null.
+ $caption_content = phutil_string_cast($caption_content);
+
+ if ($caption_content !== '') {
$caption = phutil_tag(
'div',
array('class' => 'aphront-form-caption'),
- $this->getCaption());
+ $caption_content);
} else {
$caption = null;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 28, 18:44 (7 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1036219
Default Alt Text
D25231.1735411492.diff (1 KB)
Attached To
Mode
D25231: AphrontFormControl: fix regression for some specific Captions
Attached
Detach File
Event Timeline
Log In to Comment