You are here

function content_multigroup_content_generate in Custom Formatters 6

File

includes/content_multigroup.inc, line 81
Provides Custom Formatters integration with the Content Multigroup module.

Code

function content_multigroup_content_generate($node, $field) {
  $item = array();
  foreach (fieldgroup_groups($node['type']) as $group) {
    if ($group['group_type'] == 'multigroup') {
      foreach ($group['fields'] as $field) {
        if (function_exists($function = "{$field['widget_module']}_content_generate")) {
          $item[$field['field_name']] = $function($node, content_fields($field['field_name']));
          $element = array(
            '#node' => $node,
            '#item' => $item[$field['field_name']],
          );
          $item[$field['field_name']]['view'] = theme("{$field['widget_module']}_formatter_default", $element);
        }
      }
    }
  }
  return $item;
}