public function toDoc() { $temp = $this->{'joinable-sections'}; $this->{'joinable-sections'} = array(); $doc = parent::toDoc(); $doc->formatOutput = true; $parent = $doc->xpath('/field/joinable-sections')->item(0); $this->{'joinable-sections'} = $temp; foreach ($this->{'joinable-sections'} as $section) { $item = $doc->createElement('item'); $item->setValue($section); $parent->appendChild($item); } return $doc; }
public function toDoc() { $suggestion_list_source = NULL; if (isset($this->properties->{'suggestion-list-source'}) && is_array($this->properties->{'suggestion-list-source'})) { $suggestion_list_source = $this->properties->{'suggestion-list-source'}; } unset($this->properties->{'suggestion-list-source'}); $include_existing = $this->{'suggestion-list-include-existing'} == true ? 'yes' : 'no'; unset($this->properties->{'suggestion-list-include-existing'}); $doc = parent::toDoc(); $this->properties->{'suggestion-list-include-existing'} = $include_existing; $this->properties->{'suggestion-list-source'} = $suggestion_list_source; if (!is_null($suggestion_list_source)) { $element = $doc->createElement('suggestion-list-source'); $element->setAttribute('include-existing', $include_existing); foreach ($suggestion_list_source as $key => $value) { list($section, $field) = $value; $item = $doc->createElement('item'); $item->setAttributeArray(array('section' => $section, 'field' => $field)); $element->appendChild($item); } $doc->documentElement->appendChild($element); } return $doc; }
public function toDoc() { $related_fields = NULL; if (isset($this->properties->{'related-fields'}) && is_array($this->properties->{'related-fields'})) { $related_fields = $this->properties->{'related-fields'}; } unset($this->properties->{'related-fields'}); $doc = parent::toDoc(); $this->properties->{'related-fields'} = $related_fields; if (!is_null($related_fields)) { $element = $doc->createElement('related-fields'); foreach ($related_fields as $key => $value) { list($section, $field) = $value; $item = $doc->createElement('item'); $item->setAttributeArray(array('section' => $section, 'field' => $field)); $element->appendChild($item); } $doc->documentElement->appendChild($element); } return $doc; }