/** * Generate the search field node * of a free type * for the search_fields node * * @param DOMDocument $doc * @param search_fields $parentNode */ public function generateXml($doc, $parentNode, $prefix = '') { $name = $prefix ? $prefix . '-' . $this->getName() : $this->getName(); $label = $doc->createElement('search_field'); $label->setAttribute('type', $this->getType()); $label->setAttribute('name', $name); $label->setAttribute('label', $this->getLabel()); $label->setAttribute('quantity', ""); $parentNode->appendChild($label); }
/** * Generate the search field node * of a option_list type * for the search_fields node * * @param DOMDocument $doc * @param search_fields $parentNode */ public function generateXml($doc, $parentNode, $prefix = '') { $name = $prefix ? $prefix . '-' . $this->getName() : $this->getName(); $tag = $doc->createElement('search_field'); $tag->setAttribute('type', 'option_list'); $tag->setAttribute('name', $name); $tag->setAttribute('label', $this->getLabel()); $tagChild = $doc->createElement('option_list'); $tag->appendChild($tagChild); foreach ($this->options as $option) { $tagOption = $doc->createElement('option'); $tagId = $doc->createElement('id'); $text = $doc->createTextNode($option->getId()); $text = $tagId->appendChild($text); $tagDesc = $doc->createElement('description'); $textDesc = $doc->createTextNode($option->getDescription()); $text = $tagDesc->appendChild($textDesc); $tagOption->appendChild($tagId); $tagOption->appendChild($tagDesc); $tagChild->appendChild($tagOption); } $parentNode->appendChild($tag); }