Moving OpenAtrium Node Form Elements to the Right Column
Previously, I discussed how you could move CCK fields into the node form sidebar by careful fieldgroup naming.
If you are of a programmer’s bent, you might instead try the more flexible programmer’s solution–preprocessor function. I dug this out of the atrium_blog feature.
This code snippet isolates a nodereference field attached to blog content and pushes it into the sidebar. This should work to move entire fieldgroups of form elements too.
/** * Preprocessor for theme('node_form'). */ function atrium_blog_preprocess_node_form(&$vars) { if (!empty($vars['form']['field_referenced_book_page'])) { $vars['sidebar']['field_referenced_book_page'] = $vars['form']['field_referenced_book_page']; unset($vars['form']['field_referenced_book_page']); } }
OpenAtrium 1.0-beta8
As of Beta 8, the above code does not seem to work. I haven’t found the ideal solution, but it’s match in Beta8 is as follows:
This is the result of Open Atrium’s move to using the Nodeformcols to facilitate sidebar wrangling.
/** * Preprocessor function for node form. * Move CCK field to the sidebar. */ function custom_preprocess_node_form($vars) { if (!empty($vars['form']['nodeformcols_region_main']['field_sidebar_reference'])) { $vars['form']['nodeformcols_region_right']['field_sidebar_reference'] = $vars['form']['nodeformcols_region_main']['field_sidebar_reference']; unset($vars['form']['nodeformcols_region_main']['field_sidebar_reference']); } }