? css ? js Index: elements.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/elements/elements.module,v retrieving revision 1.1.2.2.2.9.2.2 diff -u -p -r1.1.2.2.2.9.2.2 elements.module --- elements.module 12 Dec 2010 00:24:16 -0000 1.1.2.2.2.9.2.2 +++ elements.module 2 Feb 2011 17:53:59 -0000 @@ -51,6 +51,12 @@ function elements_element_info() { '#theme' => 'rangefield', '#theme_wrappers' => array('form_element'), ); + $types['horizontal_tabs'] = array( + '#theme_wrappers' => array('horizontal_tabs'), + '#default_tab' => '', + '#pre_render' => array('form_pre_render_fieldset'), + '#process' => array('form_process_horizontal_tabs'), + ); return $types; } @@ -105,6 +111,10 @@ function elements_theme() { 'render element' => 'element', 'file' => 'elements.theme.inc', ), + 'horizontal_tabs' => array( + 'render element' => 'element', + 'file' => 'elements.theme.inc', + ), ); } @@ -154,3 +164,30 @@ function form_process_placeholder($eleme } return $element; } + +/** + * Creates a group formatted as horizontal tabs. + * + * @param $element + * An associative array containing the properties and children of the + * fieldset. + * @param $form_state + * The $form_state array for the form this vertical tab widget belongs to. + * @return + * The processed element. + */ +function form_process_horizontal_tabs($element, &$form_state) { + // Inject a new fieldset as child, so that form_process_fieldset() processes + // this fieldset like any other fieldset. + $element['group'] = array( + '#type' => 'fieldset', + '#theme_wrappers' => array(), + '#parents' => $element['#parents'], + ); + + // Add JS and CSS necessary for the horizontal tabs + $element['#attached']['js'][] = drupal_get_path('module', 'elements') . '/js/horizontal_tab.js'; + $element['#attached']['css'][] = drupal_get_path('module', 'elements') . '/css/horizontal_tab.css'; + + return $element; +} Index: elements.theme.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/elements/Attic/elements.theme.inc,v retrieving revision 1.1.4.2 diff -u -p -r1.1.4.2 elements.theme.inc --- elements.theme.inc 11 Dec 2010 22:32:35 -0000 1.1.4.2 +++ elements.theme.inc 2 Feb 2011 17:53:59 -0000 @@ -142,3 +142,21 @@ function theme_rangefield($variables) { return $output; } + +/** + * Returns HTML for an element's children fieldsets as horizontal tabs. + * + * @param $variables + * An associative array containing: + * - element: An associative array containing the properties of the element. + * Properties used: #children. + * + * @ingroup themeable + */ +function theme_horizontal_tabs($variables) { + $element = $variables['element']; + + $output = '

' . t('Horizontal Tabs') . '

'; + $output .= '
' . $element['#children'] . '
'; + return $output; +}