Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sylus/a529dfc872df178af7892ca8e9eb7d92 to your computer and use it in GitHub Desktop.
Save sylus/a529dfc872df178af7892ca8e9eb7d92 to your computer and use it in GitHub Desktop.
From 98bc9ffd208b178249642136baa2a9c6e19dd748 Mon Sep 17 00:00:00 2001
From: William Hearn <[email protected]>
Date: Mon, 8 Mar 2021 12:44:47 -0500
Subject: [PATCH] feat(webform): Add filtered value for node references
---
webform_references.node.inc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/webform_references.node.inc b/webform_references.node.inc
index e275c8f..6ba6151 100755
--- a/webform_references.node.inc
+++ b/webform_references.node.inc
@@ -458,8 +458,9 @@ function _webform_theme_node_reference() {
*/
function _webform_display_node_reference(array $component, $value, $format = 'html') {
$value = (array) $value;
+ $filtered_value = array_filter($value);
return array(
- '#title' => $component['name'],
+ '#title' => (!empty($value) && !empty($filtered_value)) ? $component['name'] : NULL,
'#weight' => $component['weight'],
'#theme' => 'webform_display_node_reference_field',
'#theme_wrappers' => $format == 'html' ? array('webform_element') : array('webform_element_text'),
--
2.21.0 (Apple Git-122)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment