You are here

function ds_render_group in Display Suite 6.2

Return a rendered fieldset group.

Parameters

object $object: The object (e.g. a node) containing the group to be rendered

string $group_key: The key of the group to render

array $vars: (optional) The $vars array

Return value

string|bool a string containing the fully-rendered group, or FALSE if one is not rendered

1 call to ds_render_group()
ds_render_content in ./ds.module
Render content for an object.

File

./ds.module, line 872
Core functions for the Display Suite module.

Code

function ds_render_group(&$object, $group_key, $vars = array()) {
  $object->ds_fields[$group_key]['content'] = '';
  if (array_key_exists($group_key, $object->ds_groups)) {

    // Sort group items by weight, and pass them to the render function.
    asort($object->ds_groups[$group_key]);
    foreach (array_keys($object->ds_groups[$group_key]) as $field_key) {

      // Items inside groups wont have a content value set, so assign it now
      // @todo find a way to move ds_set_content into a consistent place for
      // all fields, e.g. ds_build_fields_and_objects.
      $object->ds_fields[$group_key]['fields'][$field_key]['content'] = ds_get_content($object->ds_fields[$group_key]['fields'][$field_key], $vars, $field_key);
      $object->ds_fields[$group_key]['fields'][$field_key]['rendered'] = ds_render_item($object->ds_fields[$group_key]['fields'][$field_key]);
      $object->ds_fields[$group_key]['content'] .= $object->ds_fields[$group_key]['fields'][$field_key]['rendered'];
    }
    $object->ds_fields[$group_key]['count'] = count($object->ds_fields[$group_key]['fields']);

    // Render the complete group.
    if (!empty($object->ds_fields[$group_key]['content'])) {
      $object->ds_fields[$group_key]['rendered'] = ds_render_item($object->ds_fields[$group_key]);
    }
  }
  return $object->ds_fields[$group_key]['rendered'];
}