? better_cck_handling.patch Index: workflow_fields.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/workflow_fields/workflow_fields.install,v retrieving revision 1.1.4.5 diff -u -p -r1.1.4.5 workflow_fields.install --- workflow_fields.install 25 Sep 2008 19:18:02 -0000 1.1.4.5 +++ workflow_fields.install 18 Mar 2009 06:14:30 -0000 @@ -7,6 +7,8 @@ function workflow_fields_install() { switch ($GLOBALS['db_type']) { case 'mysqli': case 'mysql': + //We have to be > weight 9 so we can add markup to field groups added by fieldgroup.module + $result[] = db_query("UPDATE {system} SET weight = 10 WHERE name = 'workflow_fields'"); $result[] = db_query( << weight 9 so we can add markup to field groups added by fieldgroup.module + $items[] = update_sql("UPDATE {system} SET weight = 10 WHERE name = 'workflow_fields'"); + break; + case 'pgsql': + drupal_set_message(t('PGSQL is currently not supported by workflow_fields.'), 'error'); + break; + } + return $items; +} + function workflow_fields_uninstall() { switch ($GLOBALS['db_type']) { case 'mysql': Index: workflow_fields.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/workflow_fields/workflow_fields.module,v retrieving revision 1.5.2.22 diff -u -p -r1.5.2.22 workflow_fields.module --- workflow_fields.module 10 Dec 2008 21:37:19 -0000 1.5.2.22 +++ workflow_fields.module 18 Mar 2009 06:14:30 -0000 @@ -233,8 +233,7 @@ function workflow_fields_node_form_alter $field = $fields[$key]; if (!$visible || variable_get('workflow_fields_hide_read_only_when_editing', FALSE)) { if (isset($content['fields'][$key])) { // CCK? - $element['#prefix'] = '
'; - $element['#suffix'] = '
'; + _workflow_fields_hide_cck_field($element); } else { $element['#type'] = 'value'; @@ -244,14 +243,18 @@ function workflow_fields_node_form_alter if (isset($content['fields'][$key])) { // CCK? $weight = $element['#weight']; $node_field = isset($node->$key) ? $node->$key : array(); - $form[$key .'_view'] = array( - '#type' => 'markup', - '#value' => _workflow_fields_node_view($node, $field, $node_field), - '#weight' => $weight, - ); - // FIXME This is hackable. I could not figure out a way to cleanly remove the fields. - $element['#prefix'] = '
'; - $element['#suffix'] = '
'; + $markup = array( + '#type' => 'markup', + '#value' => _workflow_fields_node_view($node, $field, $node_field), + '#weight' => $weight, + ); + if (module_exists('fieldgroup') && $group = fieldgroup_get_group($content['type'], $key)) { + $form[$group][$key . '_view'] = $markup; + } + else { + $form[$key .'_view'] = $markup; + } + _workflow_fields_hide_cck_field($element); } else { $element['#disabled'] = TRUE; @@ -264,6 +267,20 @@ function workflow_fields_node_form_alter } } +function _workflow_fields_hide_cck_field(&$element) { + $keys = array_keys($element); + foreach($keys as $k) { + if (!is_string($k) || substr($k,0,1) != '#' ) { + if (array_key_exists('value', $element[$k])) { + $element[$k]['value']['#access'] = FALSE; + } + else { + $element[$k]['#access'] = FALSE; + } + } + } +} + /** * Return an array of rids for the current user, given a node. * Include FIELD_ROLE_AUTHOR if the current user is the node author.