Eko\FeedBundle\Formatter\Formatter::addChannelFields PHP Method

addChannelFields() protected method

Adds channel fields to given channel.
protected addChannelFields ( DOMElement $channel )
$channel DOMElement
    protected function addChannelFields(\DOMElement $channel)
    {
        foreach ($this->feed->getChannelFields() as $field) {
            if ($field instanceof GroupChannelField) {
                $parent = $this->dom->createElement($field->getName());
                foreach ($field->getItemFields() as $childField) {
                    $child = $this->dom->createElement($childField->getName(), $childField->getValue());
                    $this->addAttributes($child, $childField);
                    $parent->appendChild($child);
                }
            } else {
                $parent = $this->dom->createElement($field->getName(), $field->getValue());
            }
            $this->addAttributes($parent, $field);
            $channel->appendChild($parent);
        }
    }