Commit 256dfdb9 authored by KarenS's avatar KarenS

#960506 by markdorison, Add an unordered list to the basic display options for multigroup.

parent 9e0d51f5
......@@ -300,6 +300,7 @@ function content_multigroup_display_overview_form(&$form, &$form_state) {
'hr' => t('Horizontal line'),
'table-single' => t('Table - Single column'),
'table-multiple' => t('Table - Multiple columns'),
'ul' => t('Unordered List'),
);
foreach (fieldgroup_groups($type_name) as $group_name => $group) {
if ($group['group_type'] != 'multigroup') {
......
......@@ -4,4 +4,5 @@ description = Combine multiple CCK fields into repeating field collections that
dependencies[] = content
dependencies[] = fieldgroup
package = CCK
core = 6.x
\ No newline at end of file
core = 6.x
......@@ -80,6 +80,10 @@ function content_multigroup_theme() {
'arguments' => array('element' => NULL),
'file' => 'content_multigroup.node_view.inc',
),
'content_multigroup_display_ul' => array(
'arguments' => array('element' => NULL),
'file' => 'content_multigroup.node_view.inc',
),
);
}
......
......@@ -109,6 +109,11 @@ function _content_multigroup_fieldgroup_view(&$node, &$element, $group, $context
$element['#attributes']['class'] = $group_class .' content-multigroup-display-table-multiple-columns';
$element['#fields'] = $group_fields;
break;
case 'ul':
$element['#theme'] = 'content_multigroup_display_ul';
$element['#attributes']['class'] = $group_class;
$element['#fields'] = $group_fields;
break;
}
}
......@@ -235,3 +240,22 @@ function theme_content_multigroup_display_table_multiple($element) {
}
return count($rows) ? theme('table', $headers, $rows, $element['#attributes']) : '';
}
/**
* Theme a subgroup of fields in an unordered list.
*
* No output is generated if all fields are empty.
*/
function theme_content_multigroup_display_ul($element) {
$items = array();
foreach (element_children($element) as $delta) {
foreach ($element['#fields'] as $field_name => $field) {
$item = drupal_render($element[$delta][$field_name]);
if (!empty($item)) {
$items[] = $item;
}
}
}
$element['#attributes']['class'] .= ' content-multigroup';
return count($items) ? theme('item_list', $items, $element['#title'], 'ul', $element['#attributes']) : '';
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment