summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoelstein2018-04-19 18:14:04 (GMT)
committerMark Carver2018-04-19 18:14:04 (GMT)
commit908e4e5333bf62ab2a5312e4784ec44551f3bcd6 (patch)
tree0cd7d943a8fe9a15bc7562847435ec2b346a09e8
parentd34dbf76b5d59a516406220406ba5cec5f04af49 (diff)
Issue #2136095 by joelstein: webform_managed_file buttons do not display correctly
-rw-r--r--templates/file/file-managed-file.func.php5
-rw-r--r--templates/webform/webform-managed-file.func.php27
2 files changed, 31 insertions, 1 deletions
diff --git a/templates/file/file-managed-file.func.php b/templates/file/file-managed-file.func.php
index 87d9b97..c11fc63 100644
--- a/templates/file/file-managed-file.func.php
+++ b/templates/file/file-managed-file.func.php
@@ -24,9 +24,12 @@ function bootstrap_file_managed_file(array $variables) {
$element = $variables['element'];
$attributes = array();
- if (isset($element['#id'])) {
+
+ // For Webform use, do not add the id to the wrapper.
+ if (isset($element['#id']) && empty($element['#webform_component'])) {
$attributes['id'] = $element['#id'];
}
+
if (!empty($element['#attributes']['class'])) {
$attributes['class'] = (array) $element['#attributes']['class'];
}
diff --git a/templates/webform/webform-managed-file.func.php b/templates/webform/webform-managed-file.func.php
new file mode 100644
index 0000000..00a6d47
--- /dev/null
+++ b/templates/webform/webform-managed-file.func.php
@@ -0,0 +1,27 @@
+<?php
+
+/**
+ * @file
+ * Stub file for bootstrap_webform_managed_file().
+ */
+
+/**
+ * Returns HTML for a Webform managed file element.
+ *
+ * @param array $variables
+ * An associative array containing:
+ * - element: A render element representing the file.
+ *
+ * @return string
+ * The constructed HTML.
+ *
+ * @see theme_webform_managed_file()
+ * @see bootstrap_file_managed_file()
+ *
+ * @ingroup theme_functions
+ */
+function bootstrap_webform_managed_file(array $variables) {
+ // Render with Bootstrap's managed file theme function.
+ bootstrap_include('bootstrap', 'templates/file/file-managed-file.func.php');
+ return bootstrap_file_managed_file($variables);
+}