summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-03-30 03:15:41 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-03-30 03:15:41 +0000
commit28aaa036e471a5d96be3938545c49e2dc71e342e (patch)
tree9fa1fe8e8ecd6cff16f15204a016faa4c92b0011 /includes
parent2feffc2d61bf8b022f28e51dbea313602706661d (diff)
downloadbrdo-28aaa036e471a5d96be3938545c49e2dc71e342e.tar.gz
brdo-28aaa036e471a5d96be3938545c49e2dc71e342e.tar.bz2
#304330 follow-up by sun: Clean-up of text format widget patch.
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc3
-rw-r--r--includes/form.inc30
2 files changed, 31 insertions, 2 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 2940d53b2..d80aefeee 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -3717,6 +3717,9 @@ function drupal_common_theme() {
'form_element' => array(
'arguments' => array('element' => NULL),
),
+ 'text_format_wrapper' => array(
+ 'arguments' => array('element' => NULL),
+ ),
);
}
diff --git a/includes/form.inc b/includes/form.inc
index 8e57737fd..f6a131a53 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -1927,20 +1927,46 @@ function form_process_text_format($element) {
// We need to break references, otherwise form_builder recurses infinitely.
$element['value'] = (array)$element;
+ $element['value']['#weight'] = 0;
+ unset($element['value']['#description']);
$element['#type'] = 'markup';
$element['#theme'] = NULL;
- $element['#theme_wrapper'] = NULL;
+ $element['#theme_wrapper'] = 'text_format_wrapper';
$element['format'] = filter_form($element['#text_format'], 1, $element_parents);
// We need to clear the #text_format from the new child otherwise we
// would get into an infinite loop.
unset($element['value']['#text_format']);
- $element['value']['#weight'] = 0;
}
return $element;
}
/**
+ * Return a themed text format form element.
+ *
+ * @param element
+ * An associative array containing the properties of the element.
+ * Properties used: children, description
+ * @return
+ * A string representing the form element.
+ *
+ * @ingroup themeable
+ */
+function theme_text_format_wrapper($element) {
+ $output = '<div class="text-format-wrapper">' . "\n";
+
+ $output .= $element['#children'] . "\n";
+
+ if (!empty($element['#description'])) {
+ $output .= '<div class="description">' . $element['#description'] . "</div>\n";
+ }
+
+ $output .= "</div>\n";
+
+ return $output;
+}
+
+/**
* Add AHAH information about a form element to the page to communicate with
* javascript. If #ahah[path] is set on an element, this additional javascript is
* added to the page header to attach the AHAH behaviors. See ahah.js for more