Beispiel #1
0
 /**
  * @param \DOMNode    $parent
  * @param ValuesGroup $valuesGroup
  * @param FieldSet    $fieldSet
  */
 private function exportGroupNode(\DOMNode $parent, ValuesGroup $valuesGroup, FieldSet $fieldSet)
 {
     $fields = $valuesGroup->getFields();
     if ($valuesGroup->countValues() > 0) {
         $fieldsNode = $this->document->createElement('fields');
         foreach ($fields as $name => $values) {
             if (!$values->count()) {
                 continue;
             }
             $fieldLabel = $this->labelResolver->resolveFieldLabel($fieldSet, $name);
             $fieldNode = $this->document->createElement('field');
             $fieldNode->setAttribute('name', $fieldLabel);
             $this->exportValuesToNode($values, $fieldNode, $fieldSet->get($name));
             $fieldsNode->appendChild($fieldNode);
         }
         $parent->appendChild($fieldsNode);
     }
     if ($valuesGroup->hasGroups()) {
         $groupsNode = $this->document->createElement('groups');
         foreach ($valuesGroup->getGroups() as $group) {
             $groupNode = $this->document->createElement('group');
             $groupNode->setAttribute('logical', $group->getGroupLogical());
             $this->exportGroupNode($groupNode, $group, $fieldSet);
             $groupsNode->appendChild($groupNode);
         }
         $parent->appendChild($groupsNode);
     }
 }