summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--template.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/template.php b/template.php
index 4a8f89e..6fc6ebe 100644
--- a/template.php
+++ b/template.php
@@ -419,3 +419,25 @@ function zen_page_alter(&$page) {
}
}
}
+
+/**
+ * Implements hook_form_BASE_FORM_ID_alter().
+ *
+ * Prevent user-facing field styling from screwing up node edit forms by
+ * renaming the classes on the node edit form's field wrappers.
+ */
+function zen_form_node_form_alter(&$form, &$form_state, $form_id) {
+ // Remove if #1245218 is backported to D7 core.
+ foreach (array_keys($form) as $item) {
+ if (strpos($item, 'field_') === 0) {
+ if (!empty($form[$item]['#attributes']['class'])) {
+ foreach ($form[$item]['#attributes']['class'] as &$class) {
+ if (strpos($class, 'field-type-') === 0 || strpos($class, 'field-name-') === 0) {
+ // Make the class different from that used in theme_field().
+ $class = 'form-' . $class;
+ }
+ }
+ }
+ }
+ }
+}