You are here

class dsFieldGroup in Display Suite 6.3

The group field type

Hierarchy

Expanded class hierarchy of dsFieldGroup

1 string reference to 'dsFieldGroup'
group.inc in plugins/ds_field/group.inc

File

plugins/ds_field/group.inc, line 17

View source
class dsFieldGroup extends dsField {

  /**
   * Implements dsField::render()
   * @todo
   */
  function render(&$object, $group_key, $vars = array()) {
    $object->ds_fields[$group_key]['content'] = '';
    if (array_key_exists($group_key, $object->ds_fields)) {

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

        // 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']);

      // @todo - is this still required?
      // 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'];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
dsField::$attributes protected property Field attributes
dsField::$content public property Content for the field
dsField::$key public property Field key
dsField::$settings public property Field settings
dsField::build function Build an individual field value
dsField::defaults protected function Return default values for a field
dsField::formatContent public function Format content for use in an item. 2
dsField::getContent function Get content for use in a field.
dsField::initialise public function Initialise field defaults
dsField::setting public function Wrapper to set a value on a field
dsFieldGroup::render function Implements dsField::render() @todo Overrides dsField::render