You are here

function field_group_unpack in Field Group 7

Same name and namespace in other branches
  1. 7.2 field_group.module \field_group_unpack()

Unpacks a database row in a FieldGroup object.

Parameters

$packed_group: Database result object with stored group data.

Return value

$group Field group object.

2 calls to field_group_unpack()
field_group_load_field_group in ./field_group.module
Loads a group definition.
field_group_read_groups in ./field_group.module
Read all groups.

File

./field_group.module, line 1773
Fieldgroup module.

Code

function field_group_unpack($packed_group) {
  if (empty($packed_group->data)) {
    return $packed_group;
  }

  // Extract unserialized data.
  $group = clone $packed_group;
  $data = $group->data;
  unset($group->data);
  $group->label = isset($data['label']) ? $data['label'] : '';
  $group->weight = isset($data['weight']) ? $data['weight'] : '';
  $group->children = isset($data['children']) ? $data['children'] : '';
  $group->format_type = !empty($data['format_type']) ? $data['format_type'] : 'fieldset';
  if (isset($data['format_settings'])) {
    $group->format_settings = $data['format_settings'];
  }
  return $group;
}